thanos-io/thanos · error

lazy load index-header for block

Error message

lazy load index-header for block %s

What it means

LazyBinaryReader.load failed creating the underlying BinaryReader (downloading/reading the index header from the bucket on first lazy use). The error is cached in readerErr so subsequent reads fail fast until reload.

Solutions

  1. Check bucket access for the block's index-header file
  2. Verify the index-header exists or regenerate it
  3. Clear cached error by reloading the block
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at pkg/block/indexheader/lazy_binary_reader.go:273 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at pkg/block/indexheader/lazy_binary_reader.go:273

	}()

	// Ensure none else tried to load it in the meanwhile.
	if r.reader != nil {
		return nil
	}
	if r.readerErr != nil {
		return r.readerErr
	}

	level.Debug(r.logger).Log("msg", "lazy loading index-header", "block", r.id)
	r.metrics.loadCount.Inc()
	startTime := time.Now()

	reader, err := NewBinaryReader(r.ctx, r.logger, r.bkt, r.dir, r.id, r.postingOffsetsInMemSampling, r.binaryReaderMetrics)
	if err != nil {
		r.metrics.loadFailedCount.Inc()
		r.readerErr = err
		return errors.Wrapf(err, "lazy load index-header for block %s", r.id)
	}

	r.reader = reader
	level.Debug(r.logger).Log("msg", "lazy loaded index-header", "block", r.id, "elapsed", time.Since(startTime))
	r.metrics.loadDuration.Observe(time.Since(startTime).Seconds())

	return nil
}

// unloadIfIdleSince closes underlying BinaryReader if the reader is idle since given time (as unix nano). If idleSince is 0,
// the check on the last usage is skipped. Calling this function on a already unloaded reader is a no-op.
func (r *LazyBinaryReader) unloadIfIdleSince(ts int64) error {
	r.readerMx.Lock()
	defer r.readerMx.Unlock()

	// Nothing to do if already unloaded.
	if r.reader == nil {
		return nil

View on GitHub (pinned to 35b8b99117)