{"record":{"id":"2277d2101a14c098","repo":"thanos-io/thanos","slug":"symbols","errorCode":null,"errorMessage":"symbols","messagePattern":"symbols","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/compactv2/chunk_series_set.go","lineNumber":188,"sourceCode":"\tif l.populated == nil {\n\t\tl.populate()\n\t}\n\tl.populated.Compact()\n}\n\nfunc (w *Compactor) write(ctx context.Context, symbols index.StringIter, populatedSet storage.ChunkSeriesSet, sWriter block.SeriesWriter, p ProgressLogger) error {\n\tvar (\n\t\tchks []chunks.Meta\n\t\tref  storage.SeriesRef\n\t)\n\n\tfor symbols.Next() {\n\t\tif err := sWriter.AddSymbol(symbols.At()); err != nil {\n\t\t\treturn errors.Wrap(err, \"add symbol\")\n\t\t}\n\t}\n\tif err := symbols.Err(); err != nil {\n\t\treturn errors.Wrap(err, \"symbols\")\n\t}\n\n\t// Iterate over all sorted chunk series.\n\tfor populatedSet.Next() {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn ctx.Err()\n\t\tdefault:\n\t\t}\n\n\t\ts := populatedSet.At()\n\t\tchksIter := s.Iterator(nil)\n\t\tchks = chks[:0]\n\t\tfor chksIter.Next() {\n\t\t\t// We are not iterating in streaming way over chunk as it's more efficient to do bulk write for index and\n\t\t\t// chunk file purposes.\n\t\t\tchks = append(chks, chksIter.At())\n\t\t}","sourceCodeStart":170,"sourceCodeEnd":206,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/compactv2/chunk_series_set.go#L170-L206","documentation":"After iterating symbols, the library checks symbols.Err() and wraps any iteration error with \"symbols\". This means the symbol iterator itself failed mid-enumeration (not AddSymbol) — the underlying postings/symbol lookup returned an error while advancing.","triggerScenarios":"write() completes the AddSymbol loop, then symbols.Err() is non-nil because the symbol set's iterator hit an index-read error (corrupt symbol table, IO failure reading the source index).","commonSituations":"Corrupt source block symbol table, block index removed mid-compaction, network/IO errors reading index from object-storage-backed readers.","solutions":["Check the source block's index integrity; re-download or repair a corrupt symbol table.","Ensure no external process deletes source blocks during compaction.","Retry the compaction after transient IO failures; re-open block readers to reset cached errors.","If reproducible, restore the block from backup/object-store replication before compacting."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if err := idx.ReadSymbols(ctx, symbolTableSize); err != nil {\n    return fmt.Errorf(\"symbol table unreadable: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"if err := WriteSeries(ctx, populatedSet, symbols); err != nil {\n    if isIndexIOError(errors.Cause(err)) {\n        // re-sync block and retry once\n        if rerr := resyncBlock(ctx, srcID); rerr == nil {\n            return WriteSeries(ctx, populatedSet, symbols)\n        }\n    }\n    return err\n}","preventionTips":["Validate source block symbol tables before compaction (bucket verify)","Prevent concurrent deletion of source blocks during compaction","Set generous timeouts for object-storage-backed index reads","Re-open block readers after transient IO failures to reset error state"],"tags":["go","tsdb","index","iterator"],"backgroundTag":"database-query-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"}