{"record":{"id":"98ed64a49568cee0","repo":"thanos-io/thanos","slug":"cannot-repair-downsampled-blocks","errorCode":null,"errorMessage":"cannot repair downsampled blocks","messagePattern":"cannot repair downsampled blocks","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/verifier/index_issue.go","lineNumber":90,"sourceCode":"\t\t}\n\t\tlevel.Info(ctx.Logger).Log(\"msg\", \"all good, continuing\", \"id\", id)\n\t}\n\n\tlevel.Info(ctx.Logger).Log(\"msg\", \"verified issue\", \"with-repair\", repair)\n\treturn nil\n}\n\nfunc repairIndex(stats block.HealthStats, ctx Context, id ulid.ULID, meta *metadata.Meta, dir string) (err error) {\n\tif stats.OutOfOrderChunks > stats.DuplicatedChunks {\n\t\tlevel.Warn(ctx.Logger).Log(\"msg\", \"detected overlaps are not entirely by duplicated chunks. We are able to repair only duplicates\", \"id\", id)\n\t}\n\n\tif stats.OutsideChunks > (stats.CompleteOutsideChunks + stats.Issue347OutsideChunks) {\n\t\tlevel.Warn(ctx.Logger).Log(\"msg\", \"detected outsiders are not all 'complete' outsiders or outsiders from https://github.com/prometheus/tsdb/issues/347. We can safely delete only these outsiders\", \"id\", id)\n\t}\n\n\tif meta.Thanos.Downsample.Resolution > 0 {\n\t\treturn errors.Wrap(err, \"cannot repair downsampled blocks\")\n\t}\n\n\tlevel.Info(ctx.Logger).Log(\"msg\", \"downloading block for repair\", \"id\", id)\n\tif err = block.Download(ctx, ctx.Logger, ctx.Bkt, id, path.Join(dir, id.String())); err != nil {\n\t\treturn errors.Wrapf(err, \"download block %s\", id)\n\t}\n\tlevel.Info(ctx.Logger).Log(\"msg\", \"downloaded block to be repaired\", \"id\", id, \"issue\")\n\n\tlevel.Info(ctx.Logger).Log(\"msg\", \"repairing block\", \"id\", id, \"issue\")\n\tresid, err := block.Repair(\n\t\tctx,\n\t\tctx.Logger,\n\t\tdir,\n\t\tid,\n\t\tmetadata.BucketRepairSource,\n\t\tblock.IgnoreCompleteOutsideChunk,\n\t\tblock.IgnoreDuplicateOutsideChunk,\n\t\tblock.IgnoreIssue347OutsideChunk,","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/verifier/index_issue.go#L72-L108","documentation":"During index-issue repair in pkg/verifier, repairIndex refuses to repair any block whose Thanos metadata Downsample.Resolution is greater than 0, returning 'cannot repair downsampled blocks'. Notably it wraps err (which is nil at this point), so the message is emitted with no underlying cause. Downsampled blocks cannot be rebuilt from raw index repair logic.","triggerScenarios":"Running index-issue repair (e.g. --repair with index issues) over a bucket that contains downsampled blocks; repairIndex encounters a block with meta.Thanos.Downsample.Resolution > 0.","commonSituations":"Buckets where the compactor downsampling is enabled and the verifier iterates all blocks including 5m/1h downsampling resolutions, or pointing the verifier at a downsampling output bucket.","solutions":["Run the repair only on raw (resolution 0) blocks/buckets","Skip or exclude downsampled blocks from the repair set","If a downsampled block is corrupted, let the compactor regenerate it from raw data or delete it","Note the error wraps a nil err — treat the message alone as the cause"],"exampleFix":"// before\nthanos tools bucket verify --objstore.bucket=metrics --repair --issues=index-issue\n// after\n# target the raw bucket only\nthanos tools bucket verify --objstore.bucket=metrics-raw --repair --issues=index-issue","handlingStrategy":"validation","validationCode":"// Read block meta and skip downsampled blocks before repair\nmeta, err := block.ReadMeta(ctx, logger, bkt, id)\nif err != nil {\n    return err\n}\nif meta.Thanos.Downsample.Resolution > 0 {\n    logger.Info(\"skipping downsampled block\", \"id\", id)\n    return nil\n}","typeGuard":null,"tryCatchPattern":"if err := repairIndex(ctx, id, dir); err != nil {\n    if strings.Contains(err.Error(), \"cannot repair downsampled blocks\") {\n        logger.Warn(\"skipping downsampled block; repair raw blocks instead\", \"id\", id)\n        return nil\n    }\n    return err\n}","preventionTips":["Point index-issue repair only at buckets holding raw blocks","Filter candidate blocks by meta.Thanos.Downsample.Resolution == 0 before repair","Regenerate corrupted downsampled blocks via the compactor instead of repairing","Remember this message carries no wrapped cause — the resolution check itself is the reason"],"tags":["thanos","verifier","downsampling","repair"],"backgroundTag":"invalid-state-transition","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"}