thanos-io/thanos · error · halt
invalid result block
Error message
invalid result block %s
What it means
Wraps (as a halt-worthy error) the failure of block.GatherIndexHealth_stats over the compacted block's index: the index could not be read or contains out-of-bounds/overlapping series outside accepted limits. Since the output of compaction itself is suspect, the whole compactor halts for manual intervention unless accept-malformed-index is enabled.
Solutions
- Investigate index health errors for the block
- Re-run compaction from source blocks
- Use --accept-malformed-index only deliberately
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at pkg/compact/compact.go:1324 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/283a2b2829ae1cea.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/compact/compact.go:1324
return false, nil, errors.Wrap(err, "remove tombstones")
}
newMeta, err := metadata.ReadFromDir(bdir)
if err != nil {
return false, nil, errors.Wrap(err, "read new meta")
}
var stats block.HealthStats
// Ensure the output block is valid.
err = tracing.DoInSpanWithErr(ctx, "compaction_verify_index", func(ctx context.Context) error {
stats, err = block.GatherIndexHealthStats(ctx, cg.logger, index, newMeta.MinTime, newMeta.MaxTime)
if err != nil {
return err
}
return stats.AnyErr()
})
if !cg.acceptMalformedIndex && err != nil {
return false, nil, halt(errors.Wrapf(err, "invalid result block %s", bdir))
}
thanosMeta := metadata.Thanos{
Labels: cg.labels.Map(),
Downsample: metadata.ThanosDownsample{Resolution: cg.resolution},
Source: metadata.CompactorSource,
SegmentFiles: block.GetSegmentFiles(bdir),
Extensions: cg.Extensions(),
}
if stats.ChunkMaxSize > 0 {
thanosMeta.IndexStats.ChunkMaxSize = stats.ChunkMaxSize
}
if stats.SeriesMaxSize > 0 {
thanosMeta.IndexStats.SeriesMaxSize = stats.SeriesMaxSize
}
newMeta, err = metadata.InjectThanos(cg.logger, bdir, thanosMeta, nil)
if err != nil {
return false, nil, errors.Wrapf(err, "failed to finalize the block %s", bdir)View on GitHub (pinned to 35b8b99117)