{"record":{"id":"3a4d15dcb0cd92e2","repo":"thanos-io/thanos","slug":"raw-resolution-must-be-higher-than-the-minimum-blo","errorCode":null,"errorMessage":"raw resolution must be higher than the minimum block size after which 5m resolution downsampling will occur (40 hours)","messagePattern":"raw resolution must be higher than the minimum block size after which 5m resolution downsampling will occur \\(40 hours\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/thanos/compact.go","lineNumber":416,"sourceCode":"\t\tinsBkt,\n\t\tconf.compactionConcurrency,\n\t\tconf.skipBlockWithOutOfOrderChunks,\n\t\tblocksCleaner,\n\t)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"create bucket compactor\")\n\t}\n\n\tretentionByResolution := map[compact.ResolutionLevel]time.Duration{\n\t\tcompact.ResolutionLevelRaw: time.Duration(conf.retentionRaw),\n\t\tcompact.ResolutionLevel5m:  time.Duration(conf.retentionFiveMin),\n\t\tcompact.ResolutionLevel1h:  time.Duration(conf.retentionOneHr),\n\t}\n\n\tif retentionByResolution[compact.ResolutionLevelRaw].Milliseconds() != 0 {\n\t\t// If downsampling is enabled, error if raw retention is not sufficient for downsampling to occur (upper bound 10 days for 1h resolution)\n\t\tif !conf.disableDownsampling && retentionByResolution[compact.ResolutionLevelRaw].Milliseconds() < downsample.ResLevel1DownsampleRange {\n\t\t\treturn errors.New(\"raw resolution must be higher than the minimum block size after which 5m resolution downsampling will occur (40 hours)\")\n\t\t}\n\t\tlevel.Info(logger).Log(\"msg\", \"retention policy of raw samples is enabled\", \"duration\", retentionByResolution[compact.ResolutionLevelRaw])\n\t}\n\tif retentionByResolution[compact.ResolutionLevel5m].Milliseconds() != 0 {\n\t\t// If retention is lower than minimum downsample range, then no downsampling at this resolution will be persisted\n\t\tif !conf.disableDownsampling && retentionByResolution[compact.ResolutionLevel5m].Milliseconds() < downsample.ResLevel2DownsampleRange {\n\t\t\treturn errors.New(\"5m resolution retention must be higher than the minimum block size after which 1h resolution downsampling will occur (10 days)\")\n\t\t}\n\t\tlevel.Info(logger).Log(\"msg\", \"retention policy of 5 min aggregated samples is enabled\", \"duration\", retentionByResolution[compact.ResolutionLevel5m])\n\t}\n\tif retentionByResolution[compact.ResolutionLevel1h].Milliseconds() != 0 {\n\t\tlevel.Info(logger).Log(\"msg\", \"retention policy of 1 hour aggregated samples is enabled\", \"duration\", retentionByResolution[compact.ResolutionLevel1h])\n\t}\n\n\tvar cleanMtx sync.Mutex\n\t// TODO(GiedriusS): we could also apply retention policies here but the logic would be a bit more complex.\n\tcleanPartialMarked := func() error {\n\t\tcleanMtx.Lock()","sourceCodeStart":398,"sourceCodeEnd":434,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/cmd/thanos/compact.go#L398-L434","documentation":"A configuration validation error in runCompact (cmd/thanos/compact.go:416). When downsampling is enabled and a raw retention is set, Thanos requires raw retention to be at least downsample.ResLevel1DownsampleRange (40 hours), otherwise 5m downsampling could never run before raw blocks are deleted, so the command refuses to start.","triggerScenarios":"--downsampling.enabled (default) plus --retention.raw set to a nonzero duration less than 40h (e.g. 24h).","commonSituations":"Operators lowering raw retention below 40h to save storage while leaving downsampling enabled; default downsampling enabled unnoticed.","solutions":["Increase --retention.raw to at least 40h (e.g. --retention.raw=40h or more)","Pass --downsampling.disable if you intentionally keep raw data for less than 40h and do not want downsampled blocks","Set --retention.raw=0s to disable raw retention entirely, which bypasses this check"],"exampleFix":"// before\nthanos compact --downsampling.enabled --retention.raw=24h ...\n// after\nthanos compact --downsampling.enabled --retention.raw=40h ...\n// or\nthanos compact --downsampling.disable --retention.raw=24h ...","handlingStrategy":"validation","validationCode":"rawRetention := time.Duration(conf.retentionRaw)\nif rawRetention != 0 && !conf.disableDownsampling && rawRetention < 40*time.Hour {\n\treturn errors.New(\"--retention.raw must be >= 40h when downsampling is enabled\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat 40h raw retention as the minimum whenever downsampling is on","Use config linting/template validation in your deployment tooling","Document retention/downsampling coupling in runbooks"],"tags":["thanos","configuration","retention","downsampling"],"backgroundTag":"invalid-config-value","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"}