thanos-io/thanos · error

validate config

Error message

validate config

What it means

This is not a distinct error but a wrapping context added by NewBucketStore in pkg/store/bucket.go:692. The underlying error (commonly errBlockSyncConcurrencyNotValid or another BucketStore.validate failure) is wrapped with errors.Wrap(err, "validate config"), so the final message reads "validate config: <cause>".

Solutions

  1. Read the wrapped cause after "validate config:" and fix that specific field.
  2. Set blockSyncConcurrency >= 1 and review all BucketStore option values.
  3. Run thanos tools bucket verify or a config lint against your flags before deploying.
  4. Pin schema/flag names to your Thanos version — flags renamed across versions leave zero values behind.

Example fix

// before
store, err := storekit.NewBucketStore(logger, reg, bkt, dir, storepb.Ingester_IngestionDisabled)
// after
store, err := storekit.NewBucketStore(logger, reg, bkt, dir, storepb.Ingester_IngestionDisabled,
    storekit.BlockSyncConcurrency(4))
if err != nil { return errors.Wrap(err, "building bucket store") }
Defensive patterns

Strategy: validation

Validate before calling

if err := cfg.Validate(); err != nil {
    return errors.Wrap(err, "invalid bucket store config")
}
store, err := NewBucketStore(...)

Try / catch

store, err := NewBucketStore(...)
if err != nil {
    if strings.Contains(err.Error(), "validate config") {
        logger.Error("bucket store config invalid", "err", err)
        os.Exit(1)
    }
    return err
}

Prevention

When it happens

Trigger: Calling NewBucketStore with an options object that fails BucketStore.validate() — e.g. blockSyncConcurrency < 1 or other invalid option combinations.

Common situations: Thanos Store Gateway / Store component startup with a bad configuration: invalid flags, misconfigured bucket store options, or incompatibilities after a version upgrade changed validation rules.

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/084095b189f9051e. Report an issue: GitHub.

Appendix: source

Thrown at pkg/store/bucket.go:692

		sortingStrategy:                 sortingStrategyStore,
		indexHeaderLazyDownloadStrategy: indexheader.AlwaysEagerDownloadIndexHeader,
		requestLoggerFunc:               NoopRequestLoggerFunc,
		blockLifecycleCallback:          &noopBlockLifecycleCallback{},

		lazyRetrievalMaxBufferedResponses: 20,
	}

	for _, option := range options {
		option(s)
	}

	// Depend on the options
	indexReaderPoolMetrics := indexheader.NewReaderPoolMetrics(extprom.WrapRegistererWithPrefix("thanos_bucket_store_", s.reg))
	s.indexReaderPool = indexheader.NewReaderPool(s.logger, lazyIndexReaderEnabled, lazyIndexReaderIdleTimeout, indexReaderPoolMetrics, s.indexHeaderLazyDownloadStrategy)
	s.metrics = newBucketStoreMetrics(s.reg) // TODO(metalmatze): Might be possible via Option too

	if err := s.validate(); err != nil {
		return nil, errors.Wrap(err, "validate config")
	}

	if dir == "" {
		return s, nil
	}

	if err := os.MkdirAll(dir, 0750); err != nil {
		return nil, errors.Wrap(err, "create dir")
	}

	return s, nil
}

// Close the store.
func (s *BucketStore) Close() (err error) {
	s.mtx.Lock()
	defer s.mtx.Unlock()

View on GitHub (pinned to 35b8b99117)