{"record":{"id":"26b46695e05e5ff5","repo":"thanos-io/thanos","slug":"create-bucket-compactor","errorCode":null,"errorMessage":"create bucket compactor","messagePattern":"create bucket compactor","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/thanos/compact.go","lineNumber":404,"sourceCode":"\t\tplanner = compact.WithVerticalCompactionDownsampleFilter(largeIndexFilterPlanner, insBkt, compactMetrics.blocksMarked.WithLabelValues(metadata.NoCompactMarkFilename, metadata.DownsampleVerticalCompactionNoCompactReason))\n\t} else {\n\t\tplanner = largeIndexFilterPlanner\n\t}\n\tblocksCleaner := compact.NewBlocksCleaner(logger, insBkt, ignoreDeletionMarkFilter, deleteDelay, compactMetrics.blocksCleaned, compactMetrics.blockCleanupFailures)\n\tcompactor, err := compact.NewBucketCompactor(\n\t\tlogger,\n\t\tsy,\n\t\tgrouper,\n\t\tplanner,\n\t\tcomp,\n\t\tcompactDir,\n\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 {","sourceCodeStart":386,"sourceCodeEnd":422,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/cmd/thanos/compact.go#L386-L422","documentation":"This is a wrapper error produced by runCompact in cmd/thanos/compact.go when compact.NewBucketCompactor fails to construct the bucket compactor. The underlying cause (bucket client, compactor options, concurrency settings) is preserved by errors.Wrap. It signals the compaction command could not even start because compactor construction failed.","triggerScenarios":"thanos compact startup where compact.NewBucketCompactor returns an error: nil ObjectStore (insBkt) input, invalid compactor options/concurrency values, or failure building internal components (e.g. splitting, retention cleaner wiring).","commonSituations":"Misconfigured --data-dir or bucket flags, nil bucket client due to earlier provider misconfiguration, incompatible concurrency flags, version drift in compact.NewBucketCompactor signature/options.","solutions":["Check startup logs for the wrapped inner error beneath 'create bucket compactor' and fix that root cause first","Verify the object store flags/flags-derived bucket client is non-nil and reachable before compaction","Confirm compaction concurrency and related flags are positive integers within supported ranges","Check Thanos version docs for changed NewBucketCompactor options"],"exampleFix":"// before\ncompactor, err := compact.NewBucketCompactor(ctx, nil, sy, insBkt, dir, nil, conf.compactionConcurrency, conf.skipBlockWithOutOfOrderChunks, blocksCleaner)\n// after\nif insBkt == nil {\n\treturn errors.New(\"bucket client is nil; check object store flags\")\n}\ncompactor, err := compact.NewBucketCompactor(ctx, nil, sy, insBkt, dir, nil, conf.compactionConcurrency, conf.skipBlockWithOutOfOrderChunks, blocksCleaner)","handlingStrategy":"validation","validationCode":"if insBkt == nil || conf.compactionConcurrency <= 0 {\n\treturn errors.New(\"invalid compactor inputs: bucket client required and concurrency must be > 0\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate all compact flags in an init/config check before starting the process","Log the full error chain (errors.Cause) at startup","Pin Thanos versions and review changelogs for compactor API changes"],"tags":["thanos","compaction","startup","error-wrapping"],"backgroundTag":"invalid-argument-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"}