{"record":{"id":"4c5c045c7f7892c2","repo":"thanos-io/thanos","slug":"series","errorCode":null,"errorMessage":"series","messagePattern":"series","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/block/index.go","lineNumber":615,"sourceCode":"\t\treturn errors.Wrap(err, \"postings\")\n\t}\n\tall = indexr.SortedPostings(all)\n\n\t// We fully rebuild the postings list index from merged series.\n\tvar (\n\t\tpostings = index.NewMemPostings()\n\t\tvalues   = map[string]stringset{}\n\t\ti        = storage.SeriesRef(0)\n\t\tseries   = []seriesRepair{}\n\t)\n\n\tvar builder labels.ScratchBuilder\n\tvar chks []chunks.Meta\n\tfor all.Next() {\n\t\tid := all.At()\n\n\t\tif err := indexr.Series(id, &builder, &chks); err != nil {\n\t\t\treturn errors.Wrap(err, \"series\")\n\t\t}\n\t\t// Make sure labels are in sorted order.\n\t\tbuilder.Sort()\n\n\t\tfor i, c := range chks {\n\t\t\t// Ignore iterable as it should be nil.\n\t\t\tchks[i].Chunk, _, err = chunkr.ChunkOrIterable(c)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"chunk read\")\n\t\t\t}\n\t\t}\n\n\t\tchks, err := sanitizeChunkSequence(chks, meta.MinTime, meta.MaxTime, ignoreChkFns)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif len(chks) == 0 {","sourceCodeStart":597,"sourceCodeEnd":633,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/block/index.go#L597-L633","documentation":"This error wraps a failure from IndexReader.Series(id, &builder, &chks) in block.Rewrite (pkg/block/index.go:615) while iterating each posting ID to rebuild series. It means the series section of the source index cannot be resolved for a specific series ID — the label set or chunk metas for that posting are unreadable. Because rewrite iterates every posting, a single corrupt series entry fails the whole rewrite.","triggerScenarios":"For a given posting ID from the all-postings iterator, indexr.Series() fails decoding the label builder or chunk metadata (bad offset into the series section, invalid varint, out-of-range reference).","commonSituations":"Repairing blocks where individual series entries were corrupted by crash/incomplete write; blocks after disk errors; partially recovered block directories where index sections reference each other inconsistently.","solutions":["Identify the failing series ID from the wrapped inner error; if isolated, use promtool tsdb analyze or drop/rewrite the specific block.","Restore the block from backup or another replica; individual corrupt series entries generally cannot be repaired in place.","Quarantine (move out) the corrupt block so TSDB marks it and continues operating; re-fetch the affected time range from remote storage.","If many series fail, treat the whole index as corrupt and prefer full block re-download over Repair."],"exampleFix":"// before: one bad series aborts entire repair\nif err := indexr.Series(id, &builder, &chks); err != nil { return errors.Wrap(err, \"series\") }\n// after: tolerate isolated failures during repair by skipping bad IDs\nif err := indexr.Series(id, &builder, &chks); err != nil {\n    log.Warn(\"skipping unreadable series in rewrite\", \"id\", id, \"err\", err)\n    continue\n}","handlingStrategy":"try-catch","validationCode":"all, err := indexr.Postings(ctx, index.AllPostingsKey())\nif err != nil { return err }\nit := indexr.SortedPostings(all)\nfor it.Next() { if _, err := indexr.Series(it.At()); err != nil { log.Warn(\"unreadable series\", \"id\", it.At()) } }","typeGuard":"func isSeriesError(err error) bool { return err != nil && strings.Contains(err.Error(), \"series\") }","tryCatchPattern":"if err := block.Rewrite(ctx, meta, src, dst, indexr, chunkr, nil); err != nil {\n    var seriesErr bool\n    if strings.Contains(err.Error(), \"series\") { seriesErr = true }\n    if seriesErr { /* identify failing id from wrapped cause, skip or restore block */ }\n    return err\n}","preventionTips":["Log the failing posting ID (available in the wrapped cause) to scope corruption","For repair tooling, consider skipping isolated unreadable series instead of failing the whole rewrite","Restore from replicas rather than repeatedly rewriting blocks with corrupt series sections"],"tags":["tsdb","index","series","corruption"],"backgroundTag":"file-read-failed","analyzedSha":"35b8b991177def87ed52dcf10f9b6d87f07282c8","analyzedAt":"2026-09-07T01:49:59.689Z","contentChangedAt":"2026-09-07T01:49:59.689Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}