{"record":{"id":"42aaded66955bcf3","repo":"thanos-io/thanos","slug":"add-symbol-42aade","errorCode":null,"errorMessage":"add symbol","messagePattern":"add symbol","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/compactv2/chunk_series_set.go","lineNumber":184,"sourceCode":"\tl.populated.Reset(stream)\n}\n\nfunc (l *lazyPopulatableChunk) Compact() {\n\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() {","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/compactv2/chunk_series_set.go#L166-L202","documentation":"During compaction write-out, AddSymbol on the destination index writer failed for one of the series' symbols. The index writer rejects or fails to persist symbols (deduplicated symbol table writes), aborting the write phase of compaction.","triggerScenarios":"write() iterating symbols.Next() and calling sWriter.AddSymbol(symbols.At()) when the destination index writer errors: writing to a closed/full index file, symbol already added with a mismatched state (internal writer invariant), or underlying IO failure.","commonSituations":"Disk full on the compactor's scratch volume, adding the same symbol twice due to a duplicate symbol iterator (custom/patched index), index writer used after the block was already finalized.","solutions":["Check free disk space on the compactor's scratch/data volume — full disks are the most common cause of index write failures.","Inspect the wrapped cause; if it indicates an internal invariant (double add), verify the symbols iterator yields unique symbols.","Retry compaction with a fresh destination index writer; a failed partial index must be discarded, not appended to.","Verify block versions compatibility between source index and destination writer."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if freeDiskBytes(dataDir) < minCompactionScratchBytes {\n    return fmt.Errorf(\"insufficient scratch space: %d bytes free\", freeDiskBytes(dataDir))\n}","typeGuard":null,"tryCatchPattern":"if err := compact(ctx); err != nil {\n    if strings.Contains(errors.Cause(err).Error(), \"no space left\") {\n        cleanupPartialOutput(); return retryWithMoreSpace(err)\n    }\n    return err\n}","preventionTips":["Monitor scratch/data volume free space and alert before it fills","Discard and rebuild partial output indexes — never append to a failed writer","Ensure symbol iterators yield unique symbols if using custom index code","Keep compactor temp dirs on healthy local disks, not network mounts"],"tags":["go","tsdb","index-writer"],"backgroundTag":"file-write-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"}