thanos-io/thanos · warning

scrape manager not ready

Error message

scrape manager not ready

What it means

ErrNotReady ("scrape manager not ready") is a sentinel error returned by the rule manager's Write method when the underlying scrape manager (the TSDB appender provider) has not finished initializing. Callers such as the rule evaluation path receive it instead of results and are expected to retry later; pkg/receive treats the sibling tsdb.ErrNotReady the same way by returning it upward.

Solutions

  1. Retry the operation after a delay — ErrNotReady is transient and resolves once the scrape manager finishes initializing.
  2. Check `errors.Is(err, ErrNotReady)` (or tsdb.ErrNotReady) and treat it as a temporary condition rather than a fatal failure, mirroring pkg/receive/capnproto_writer.go's pattern.
  3. Wait for Thanos rule logs indicating the scrape manager/TSDB is ready before driving evaluations.
  4. If it persists indefinitely, investigate TSDB open failures (WAL corruption, disk issues) in startup logs.

Example fix

// before
samples, err := rm.Write(ctx, q)
if err != nil { return err }
// after
samples, err := rm.Write(ctx, q)
if errors.Is(err, ErrNotReady) {
    time.Sleep(retryInterval)
    return retry(ctx, q)
}
if err != nil { return err }
Defensive patterns

Strategy: retry

Validate before calling

func isNotReady(err error) bool {
    return errors.Is(err, ErrNotReady) || errors.Is(err, tsdb.ErrNotReady)
}
// gate writes on component readiness before calling

Type guard

func ready(err error) bool { return !errors.Is(err, ErrNotReady) }

Try / catch

samples, err := rm.Write(ctx, q)
if errors.Is(err, ErrNotReady) {
    select {
    case <-time.After(backoff):
    case <-ctx.Done():
        return ctx.Err()
    }
    return retry(ctx, q) // transient: scrape manager still starting
}
if err != nil {
    return err
}

Prevention

When it happens

Trigger: Calling ruleManager.Write (or an appender via the scrape manager) during Thanos rule startup before the scrape manager and its storage are ready, so the method short-circuits with `return nil, ErrNotReady` at cmd/thanos/rule.go:1189.

Common situations: Rule evaluation or query handling racing component startup (first evaluation ticks right after boot); slow TSDB WAL replay/block loading delaying readiness; running against a storage backend that is slow to open.

Related errors


AI-assisted analysis of thanos-io/thanos@35b8b99117 (2026-09-07). Data as JSON: /api/errors/c28db553143d4735. Report an issue: GitHub.

Appendix: source

Thrown at cmd/thanos/rule.go:1193

	defer rm.mtx.Unlock()

	rm.m = m
}

// Get the scrape manager. If is not ready, return an error.
func (rm *readyScrapeManager) Get() (*scrape.Manager, error) {
	rm.mtx.RLock()
	defer rm.mtx.RUnlock()

	if rm.m != nil {
		return rm.m, nil
	}

	return nil, ErrNotReady
}

// ErrNotReady is returned if the underlying scrape manager is not ready yet.
var ErrNotReady = errors.New("scrape manager not ready")

View on GitHub (pinned to 35b8b99117)