{"record":{"id":"bd8cb0cbb7e992b9","repo":"thanos-io/thanos","slug":"label-names","errorCode":null,"errorMessage":"label names","messagePattern":"label names","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/block/index.go","lineNumber":247,"sourceCode":"\t}\n\tvar (\n\t\tlset     labels.Labels\n\t\tprevLset labels.Labels\n\t\tbuilder  labels.ScratchBuilder\n\n\t\tchks []chunks.Meta\n\n\t\tseriesLifeDuration                          = newMinMaxSumInt64()\n\t\tseriesLifeDurationWithoutSingleSampleSeries = newMinMaxSumInt64()\n\t\tseriesChunks                                = newMinMaxSumInt64()\n\t\tchunkDuration                               = newMinMaxSumInt64()\n\t\tchunkSize                                   = newMinMaxSumInt64()\n\t\tseriesSize                                  = newMinMaxSumInt64()\n\t)\n\n\tlnames, err := r.LabelNames(ctx)\n\tif err != nil {\n\t\treturn stats, errors.Wrap(err, \"label names\")\n\t}\n\tstats.LabelNamesCount = int64(len(lnames))\n\n\tlvals, err := r.LabelValues(ctx, \"__name__\", nil)\n\tif err != nil {\n\t\treturn stats, errors.Wrap(err, \"metric label values\")\n\t}\n\tstats.MetricLabelValuesCount = int64(len(lvals))\n\n\t// As of version two all series entries are 16 byte padded. All references\n\t// we get have to account for that to get the correct offset.\n\toffsetMultiplier := 1\n\tversion := r.Version()\n\tif version >= 2 {\n\t\toffsetMultiplier = 16\n\t}\n\n\t// Per series.","sourceCodeStart":229,"sourceCodeEnd":265,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/block/index.go#L229-L265","documentation":"After reading postings, GatherIndexHealthStats calls r.LabelNames(ctx) to count label names in the index. If the index's label-name symbol/postings lookup fails, the error is wrapped as \"label names\". It indicates the index symbol or postings tables are unreadable.","triggerScenarios":"GatherIndexHealthStats/VerifyIndex on a block whose index file's label-name postings entries reference missing symbols or are truncated, or whose ctx is cancelled during LabelNames.","commonSituations":"Corrupt block uploads, partially downloaded index files, bit-rot on local disks, or scanning many blocks with tight context deadlines.","solutions":["Re-download or restore the block from its source (object storage/backup)","Confirm with VerifyIndex / index verification tooling that the symbols table is corrupt","Increase context timeout when validating large blocks","Discard the corrupt block so Thanos re-fetches it"],"exampleFix":"// before\nstats, err := block.GatherIndexHealthStats(ctx, bdir) // label names: symbols decode error\n// after\nctx, cancel := context.WithTimeout(ctx, 10*time.Minute)\ndefer cancel()\nstats, err := block.GatherIndexHealthStats(ctx, bdir)\nif err != nil { logger.Log(\"msg\", \"index health check failed\", \"err\", err) }","handlingStrategy":"try-catch","validationCode":"if err := block.VerifyIndex(ctx, bdir, 1); err != nil {\n    return fmt.Errorf(\"skip unhealthy block %s: %w\", bdir, err)\n}","typeGuard":null,"tryCatchPattern":"stats, err := block.GatherIndexHealthStats(ctx, bdir)\nif err != nil && strings.Contains(err.Error(), \"label names\") {\n    return fmt.Errorf(\"block %s symbols table corrupt: %w\", bdir, err)\n}","preventionTips":["Run VerifyIndex as a periodic maintenance job","Restore blocks only from checksum-verified sources","Keep context deadlines proportional to block size","Quarantine blocks that fail symbol lookups instead of retrying"],"tags":["corruption","index","symbols"],"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"}