thanos-io/thanos · error
create bucket compactor
Error message
create bucket compactor
What it means
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.
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
Example fix
// before
compactor, err := compact.NewBucketCompactor(ctx, nil, sy, insBkt, dir, nil, conf.compactionConcurrency, conf.skipBlockWithOutOfOrderChunks, blocksCleaner)
// after
if insBkt == nil {
return errors.New("bucket client is nil; check object store flags")
}
compactor, err := compact.NewBucketCompactor(ctx, nil, sy, insBkt, dir, nil, conf.compactionConcurrency, conf.skipBlockWithOutOfOrderChunks, blocksCleaner) Defensive patterns
Strategy: validation
Validate before calling
if insBkt == nil || conf.compactionConcurrency <= 0 {
return errors.New("invalid compactor inputs: bucket client required and concurrency must be > 0")
} Prevention
- 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
When it happens
Trigger: 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).
Common situations: Misconfigured --data-dir or bucket flags, nil bucket client due to earlier provider misconfiguration, incompatible concurrency flags, version drift in compact.NewBucketCompactor signature/options.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- create compactor
- compaction
- critical error detected
- error executing compaction
- could not group metadata for compaction
AI-assisted analysis of thanos-io/thanos@35b8b99117 (2026-09-07).
Data as JSON: /api/errors/26b46695e05e5ff5.
Report an issue: GitHub.
Appendix: source
Thrown at cmd/thanos/compact.go:404
planner = compact.WithVerticalCompactionDownsampleFilter(largeIndexFilterPlanner, insBkt, compactMetrics.blocksMarked.WithLabelValues(metadata.NoCompactMarkFilename, metadata.DownsampleVerticalCompactionNoCompactReason))
} else {
planner = largeIndexFilterPlanner
}
blocksCleaner := compact.NewBlocksCleaner(logger, insBkt, ignoreDeletionMarkFilter, deleteDelay, compactMetrics.blocksCleaned, compactMetrics.blockCleanupFailures)
compactor, err := compact.NewBucketCompactor(
logger,
sy,
grouper,
planner,
comp,
compactDir,
insBkt,
conf.compactionConcurrency,
conf.skipBlockWithOutOfOrderChunks,
blocksCleaner,
)
if err != nil {
return errors.Wrap(err, "create bucket compactor")
}
retentionByResolution := map[compact.ResolutionLevel]time.Duration{
compact.ResolutionLevelRaw: time.Duration(conf.retentionRaw),
compact.ResolutionLevel5m: time.Duration(conf.retentionFiveMin),
compact.ResolutionLevel1h: time.Duration(conf.retentionOneHr),
}
if retentionByResolution[compact.ResolutionLevelRaw].Milliseconds() != 0 {
// If downsampling is enabled, error if raw retention is not sufficient for downsampling to occur (upper bound 10 days for 1h resolution)
if !conf.disableDownsampling && retentionByResolution[compact.ResolutionLevelRaw].Milliseconds() < downsample.ResLevel1DownsampleRange {
return errors.New("raw resolution must be higher than the minimum block size after which 5m resolution downsampling will occur (40 hours)")
}
level.Info(logger).Log("msg", "retention policy of raw samples is enabled", "duration", retentionByResolution[compact.ResolutionLevelRaw])
}
if retentionByResolution[compact.ResolutionLevel5m].Milliseconds() != 0 {
// If retention is lower than minimum downsample range, then no downsampling at this resolution will be persisted
if !conf.disableDownsampling && retentionByResolution[compact.ResolutionLevel5m].Milliseconds() < downsample.ResLevel2DownsampleRange {View on GitHub (pinned to 35b8b99117)