thanos-io/thanos · error
get index version
Error message
get index version
What it means
Wraps IndexReader.IndexVersion failure in blockSeriesClient.series preloading. The store reads the index format version to decide whether expanded-posting counts need scaling (v2 hash-based posting encoding). Failure means the index version could not be fetched from the block's index reader.
Solutions
- Delete and rebuild the block's index-header (remove the .index-header file; the store regenerates it).
- Check the wrapped root error for object-store connectivity issues and retry.
- Confirm the block's Prometheus/thanos index is a supported version (>= 1); re-compact or re-upload blocks from unsupported versions.
- As a workaround, disable lazy expanded postings (store.lazy-expanded-posting-enabled=false) to skip this code path.
Defensive patterns
Strategy: retry
Try / catch
if err := query(ctx); err != nil && strings.Contains(err.Error(), "get index version") {
// likely stale/corrupt index-header: trigger rebuild, then retry once
rebuildIndexHeader(blockID)
if err := query(ctx); err != nil {
return fmt.Errorf("query failed after index-header rebuild: %w", err)
}
} Prevention
- Keep all Thanos/Prometheus components on compatible, supported versions.
- Periodically rebuild stale index-headers (store gateway does this on version mismatch).
- Monitor object-store availability; transient fetch failures surface here first on the lazy-postings path.
- Disable lazy expanded postings if this path proves unstable in your environment.
When it happens
Trigger: Lazy expanded postings are enabled and non-empty (lazyExpandedPosting true with len(lazyPostings.postings) > 0), and b.indexr.IndexVersion() errors while fetching/decoding the index version from the block's index-header or index.
Common situations: Blocks written by very old Prometheus versions lacking version metadata, corrupted index-header, object-store errors while fetching index metadata during a lazy-postings query path.
Understand the failure class
Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.
Related errors
- preload series
- Lookup labels symbols
- label names for block
- input block index not valid
- output block index not valid
AI-assisted analysis of thanos-io/thanos@35b8b99117 (2026-09-07).
Data as JSON: /api/errors/db19ed64e2d6a740.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/store/bucket.go:1287
Chunks: next.chks,
}), nil
}
func (b *blockSeriesClient) nextBatch(tenant string) error {
start := b.i
end := min(start+uint64(b.batchSize), uint64(len(b.lazyPostings.postings)))
b.i = end
lazyExpandedPosting := b.lazyPostings.lazyExpanded()
postingsBatch := b.lazyPostings.postings[start:end]
if len(postingsBatch) == 0 {
b.hasMorePostings = false
if lazyExpandedPosting {
// No need to fetch index version again if lazy posting has 0 length.
if len(b.lazyPostings.postings) > 0 {
v, err := b.indexr.IndexVersion()
if err != nil {
return errors.Wrap(err, "get index version")
}
if v >= 2 {
for i := range b.expandedPostings {
b.expandedPostings[i] = b.expandedPostings[i] / 16
}
}
}
b.indexr.storeExpandedPostingsToCache(b.blockMatchers, index.NewListPostings(b.expandedPostings), len(b.expandedPostings), tenant)
}
return nil
}
b.indexr.reset(len(postingsBatch))
if !b.skipChunks {
b.chunkr.reset()
}
if err := b.indexr.PreloadSeries(b.ctx, postingsBatch, b.bytesLimiter, b.tenant); err != nil {View on GitHub (pinned to 35b8b99117)