{"record":{"id":"83cafa19c4b1eb0f","repo":"thanos-io/thanos","slug":"the-block-sync-concurrency-must-be-equal-or-greate","errorCode":null,"errorMessage":"the block sync concurrency must be equal or greater than 1.","messagePattern":"the block sync concurrency must be equal or greater than 1\\.","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/store/bucket.go","lineNumber":116,"sourceCode":"\tPartitionerMaxGapSize = 512 * 1024\n\n\t// Labels for metrics.\n\tlabelEncode = \"encode\"\n\tlabelDecode = \"decode\"\n\n\tminBlockSyncConcurrency = 1\n\n\tenableChunkHashCalculation = true\n\n\t// SeriesBatchSize is the default batch size when fetching series from object storage.\n\tSeriesBatchSize = 10000\n\n\t// checkContextEveryNIterations is used in some tight loops to check if the context is done.\n\tcheckContextEveryNIterations = 128\n)\n\nvar (\n\terrBlockSyncConcurrencyNotValid = errors.New(\"the block sync concurrency must be equal or greater than 1.\")\n\thashPool                        = sync.Pool{New: func() any { return xxhash.New() }}\n\tpostingsPool                    zeropool.Pool[[]storage.SeriesRef]\n)\n\nfunc getPostingsSlice() []storage.SeriesRef {\n\tif p := postingsPool.Get(); p != nil {\n\t\treturn p\n\t}\n\n\t// Pre-allocate slice with initial capacity.\n\treturn make([]storage.SeriesRef, 0, 1024)\n}\n\nfunc putPostingsSlice(p []storage.SeriesRef) {\n\tpostingsPool.Put(p[:0])\n}\n\ntype bucketStoreMetrics struct {","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/store/bucket.go#L98-L134","documentation":"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.","triggerScenarios":"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.","commonSituations":"Operator passes --block-sync-concurrency=0, config file omits the field and defaults to 0, or code builds BucketStoreConfig programmatically without setting the field.","solutions":["Set blockSyncConcurrency to at least 1 in the store configuration or CLI flag.","Validate the flag/config value at load time (reject values < 1 with a clear message).","If building programmatically, initialize the struct with the recommended default instead of the zero value.","Check for integer-parsing bugs that turn an unset value into 0 rather than a default."],"exampleFix":"// before\nconc := flagInt(\"block-sync-concurrency\", 0)\n// after\nconc := flagInt(\"block-sync-concurrency\", 1)\nif conc < 1 { conc = 1 }","handlingStrategy":"validation","validationCode":"func validateSyncConcurrency(n int) error {\n    if n < 1 { return fmt.Errorf(\"blockSyncConcurrency must be >= 1, got %d\", n) }\n    return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set explicit non-zero defaults for concurrency flags","Validate config at load time before constructing stores","Never rely on zero-value structs for optional config"],"tags":["config","thanos","validation"],"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"}