thanos-io/thanos · error

unknown sync strategy

Error message

unknown sync strategy %s

What it means

runCompact validates conf.blockListStrategy against the known strategies (concurrentDiscovery or recursiveDiscovery). Any other value fails fast before any bucket work starts. It is a plain errors.Errorf naming the invalid strategy.

Solutions

  1. Set --block-list-strategy=concurrent or recursive.
  2. Omit the flag to use the default strategy.
  3. Check `thanos compact --help` for the exact accepted values.

Example fix

// before
--block-list-strategy=parallel
// after
--block-list-strategy=concurrent
Defensive patterns

Strategy: validation

Validate before calling

valid := map[string]bool{"concurrent": true, "recursive": true}
if !valid[blockListStrategy] {
    return fmt.Errorf("block-list-strategy must be concurrent|recursive, got %q", blockListStrategy)
}

Prevention

When it happens

Trigger: Passing --block-list-strategy with a value other than "concurrent" or "recursive" (typos, empty string, old values like "batch" removed in later versions).

Common situations: Config typos in Kubernetes manifests/systemd units; copying flags from an older Thanos version where the strategy set differed; leaving the flag with a blank value.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of thanos-io/thanos@35b8b99117 (2026-09-07). Data as JSON: /api/errors/a44f4ac5d877badd. Report an issue: GitHub.

Appendix: source

Thrown at cmd/thanos/compact.go:246

	// While fetching blocks, we filter out blocks that were marked for deletion by using IgnoreDeletionMarkFilter.
	// The delay of deleteDelay/2 is added to ensure we fetch blocks that are meant to be deleted but do not have a replacement yet.
	// This is to make sure compactor will not accidentally perform compactions with gap instead.
	ignoreDeletionMarkFilter := block.NewIgnoreDeletionMarkFilter(logger, insBkt, deleteDelay/2, conf.blockMetaFetchConcurrency)
	duplicateBlocksFilter := block.NewDeduplicateFilter(conf.blockMetaFetchConcurrency)
	noCompactMarkerFilter := compact.NewGatherNoCompactionMarkFilter(logger, insBkt, conf.blockMetaFetchConcurrency)
	noDownsampleMarkerFilter := downsample.NewGatherNoDownsampleMarkFilter(logger, insBkt, conf.blockMetaFetchConcurrency)
	labelShardedMetaFilter := block.NewLabelShardedMetaFilter(relabelConfig, conf.dedupReplicaLabels...)
	consistencyDelayMetaFilter := block.NewConsistencyDelayMetaFilter(logger, conf.consistencyDelay, extprom.WrapRegistererWithPrefix("thanos_", reg))
	timePartitionMetaFilter := block.NewTimePartitionMetaFilter(conf.filterConf.MinTime, conf.filterConf.MaxTime)

	var blockLister block.Lister
	switch syncStrategy(conf.blockListStrategy) {
	case concurrentDiscovery:
		blockLister = block.NewConcurrentLister(logger, insBkt)
	case recursiveDiscovery:
		blockLister = block.NewRecursiveLister(logger, insBkt)
	default:
		return errors.Errorf("unknown sync strategy %s", conf.blockListStrategy)
	}
	baseMetaFetcher, err := block.NewBaseFetcher(logger, conf.blockMetaFetchConcurrency, insBkt, blockLister, conf.dataDir, extprom.WrapRegistererWithPrefix("thanos_", reg))
	if err != nil {
		return errors.Wrap(err, "create meta fetcher")
	}

	enableVerticalCompaction := conf.enableVerticalCompaction
	dedupReplicaLabels := strutil.ParseFlagLabels(conf.dedupReplicaLabels)
	if len(dedupReplicaLabels) > 0 {
		enableVerticalCompaction = true
		level.Info(logger).Log(
			"msg", "deduplication.replica-label specified, enabling vertical compaction", "dedupReplicaLabels", strings.Join(dedupReplicaLabels, ","),
		)
	}
	if enableVerticalCompaction {
		level.Info(logger).Log(
			"msg", "vertical compaction is enabled", "compact.enable-vertical-compaction", fmt.Sprintf("%v", conf.enableVerticalCompaction),
		)

View on GitHub (pinned to 35b8b99117)