{"record":{"id":"60c0c1e0bea0c738","repo":"thanos-io/thanos","slug":"could-not-calculate-downsampling-progress","errorCode":null,"errorMessage":"could not calculate downsampling progress","messagePattern":"could not calculate downsampling progress","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/thanos/compact.go","lineNumber":688,"sourceCode":"\t\t\t\t\t\treturn errors.Wrapf(err, \"could not calculate compaction progress\")\n\t\t\t\t\t}\n\n\t\t\t\t\tretGroups, err := grouper.Groups(metas)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn errors.Wrapf(err, \"could not group metadata for retention\")\n\t\t\t\t\t}\n\n\t\t\t\t\tif err = rs.ProgressCalculate(ctx, retGroups); err != nil {\n\t\t\t\t\t\treturn errors.Wrapf(err, \"could not calculate retention progress\")\n\t\t\t\t\t}\n\n\t\t\t\t\tif !conf.disableDownsampling {\n\t\t\t\t\t\tgroups, err = grouper.Groups(metas)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\treturn errors.Wrapf(err, \"could not group metadata into downsample groups\")\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif err := ds.ProgressCalculate(ctx, groups); err != nil {\n\t\t\t\t\t\t\treturn errors.Wrapf(err, \"could not calculate downsampling progress\")\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\treturn nil\n\t\t\t\t})\n\t\t\t}, func(err error) {\n\t\t\t\tcancel()\n\t\t\t})\n\t\t}\n\t}\n\n\tlevel.Info(logger).Log(\"msg\", \"starting compact node\")\n\tstatusProber.Ready()\n\treturn nil\n}\n\ntype compactConfig struct {\n\thaltOnError                                    bool","sourceCodeStart":670,"sourceCodeEnd":706,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/cmd/thanos/compact.go#L670-L706","documentation":"ds.ProgressCalculate(ctx, groups) computes downsampling progress metrics via the DownsampleProgressCalculator. Failure is wrapped as 'could not calculate downsampling progress'. This only affects progress metrics; downsampling itself happens in the main compaction loop.","triggerScenarios":"The downsampling progress calculator errors on the provided groups — usually ctx cancellation during shutdown, or inconsistent group state from overlapping blocks.","commonSituations":"'context canceled' errors during compactor termination while the progress tick runs; also rare planner errors on unusual block layouts (e.g. only 5m-resolution blocks present).","solutions":["If inner error is 'context canceled', treat as benign shutdown noise; no action needed.","Inspect the wrapped error's group and validate blocks via 'thanos tools bucket inspect'.","Fix any duplicate/overlapping blocks first (upstream grouping failures corrupt state).","Upgrade Thanos if the calculator fails on valid metadata."],"exampleFix":"null","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := ds.ProgressCalculate(ctx, groups); err != nil {\n    if errors.Is(err, context.Canceled) || ctx.Err() != nil {\n        return nil // shutdown noise\n    }\n    log.Errorf(\"could not calculate downsampling progress: %v\", err)\n    return nil\n}","preventionTips":["Treat context-canceled as benign in progress loops.","Resolve duplicate-block issues before diagnosing calculator errors.","Alert on repeated non-cancel failures rather than crashing the worker.","Keep Thanos current — downsampling calculator bugs are fixed across releases."],"tags":["thanos","downsampling","metrics"],"backgroundTag":"internal-invariant-violation","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"}