thanos-io/thanos · error

the block sync concurrency must be equal or greater than 1.

Error message

the block sync concurrency must be equal or greater than 1.

What it means

Thanos BucketStore requires blockSyncConcurrency >= minBlockSyncConcurrency (1). errBlockSyncConcurrencyNotValid is returned from BucketStore.validate() when the configured concurrency is below 1 (typically 0, e.g. from a zero-valued struct or a misparsed flag). This sentinel is wrapped with "validate config" by NewBucketStore.

Solutions

  1. Set blockSyncConcurrency to at least 1 in the store configuration or CLI flag.
  2. Validate the flag/config value at load time (reject values < 1 with a clear message).
  3. If building programmatically, initialize the struct with the recommended default instead of the zero value.
  4. Check for integer-parsing bugs that turn an unset value into 0 rather than a default.

Example fix

// before
conc := flagInt("block-sync-concurrency", 0)
// after
conc := flagInt("block-sync-concurrency", 1)
if conc < 1 { conc = 1 }
Defensive patterns

Strategy: validation

Validate before calling

func validateSyncConcurrency(n int) error {
    if n < 1 { return fmt.Errorf("blockSyncConcurrency must be >= 1, got %d", n) }
    return nil
}

Prevention

When it happens

Trigger: Constructing a BucketStore via NewBucketStore with a BucketStore option/struct whose blockSyncConcurrency field is 0 or negative — often from an unset CLI flag, an invalid --store.sync-block-duration-adjacent style config, or a zero-value struct in tests.

Common situations: Operator passes --block-sync-concurrency=0, config file omits the field and defaults to 0, or code builds BucketStoreConfig programmatically without setting the field.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at pkg/store/bucket.go:116

	PartitionerMaxGapSize = 512 * 1024

	// Labels for metrics.
	labelEncode = "encode"
	labelDecode = "decode"

	minBlockSyncConcurrency = 1

	enableChunkHashCalculation = true

	// SeriesBatchSize is the default batch size when fetching series from object storage.
	SeriesBatchSize = 10000

	// checkContextEveryNIterations is used in some tight loops to check if the context is done.
	checkContextEveryNIterations = 128
)

var (
	errBlockSyncConcurrencyNotValid = errors.New("the block sync concurrency must be equal or greater than 1.")
	hashPool                        = sync.Pool{New: func() any { return xxhash.New() }}
	postingsPool                    zeropool.Pool[[]storage.SeriesRef]
)

func getPostingsSlice() []storage.SeriesRef {
	if p := postingsPool.Get(); p != nil {
		return p
	}

	// Pre-allocate slice with initial capacity.
	return make([]storage.SeriesRef, 0, 1024)
}

func putPostingsSlice(p []storage.SeriesRef) {
	postingsPool.Put(p[:0])
}

type bucketStoreMetrics struct {

View on GitHub (pinned to 35b8b99117)