thanos-io/thanos · error

error validating the config

Error message

error validating the config

What it means

After parsing both caches, runQueryFrontend calls cfg.Validate() and wraps any failure with this message. Validate enforces cross-field rules of the query-frontend config (e.g. required options, impossible combinations). It signals the flags/inputs are individually parseable but collectively invalid.

Solutions

  1. Read the wrapped underlying error from Validate for the specific violated rule.
  2. Align flags with the documented query-frontend config constraints for your Thanos version.
  3. Check release notes/changelog for newly added validation after an upgrade.
  4. Simplify to known-good defaults and re-add flags incrementally.

Example fix

// before
query-frontend --enable-features=xfunctions --query-range-response-cache-config-file=
// after
query-frontend --enable-features=xfunctions --query-range-response-cache-config-file=/etc/thanos/cache.yml
Defensive patterns

Strategy: validation

Validate before calling

for _, f := range enabledFeatures {
  if f == "xfunctions" && resultsCacheFile == "" {
    return errors.New("xfunctions requires a results cache config")
  }
}

Try / catch

if err := cfg.Validate(); err != nil {
  log.Fatalf("query-frontend config rejected: %v", err)
}

Prevention

When it happens

Trigger: Combinations of query-frontend flags that fail Config.Validate, such as enabled features requiring a cache config that is missing, or invalid scheme/URL settings for the downstream.

Common situations: Upgrading Thanos and a previously accepted combination is now rejected; enabling cache compression without a cache; typos in required numeric/enum flags.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at cmd/thanos/query_frontend.go:303

	}

	labelsCacheConfContentYaml, err := cfg.LabelsConfig.CachePathOrContent.Content()
	if err != nil {
		return err
	}
	if len(labelsCacheConfContentYaml) > 0 {
		cacheConfig, err := queryfrontend.NewCacheConfig(logger, labelsCacheConfContentYaml)
		if err != nil {
			return errors.Wrap(err, "initializing the labels cache config")
		}
		cfg.LabelsConfig.ResultsCacheConfig = &queryrange.ResultsCacheConfig{
			Compression: cfg.CacheCompression,
			CacheConfig: *cacheConfig,
		}
	}

	if err := cfg.Validate(); err != nil {
		return errors.Wrap(err, "error validating the config")
	}

	if cfg.EnableXFunctions {
		maps.Copy(parser.Functions, parse.XFunctions)
	}

	if len(cfg.EnableFeatures) > 0 {
		for _, feature := range cfg.EnableFeatures {
			if feature == promqlExperimentalFunctions {
				parser.EnableExperimentalFunctions = true
				level.Info(logger).Log("msg", "Experimental PromQL functions enabled.", "option", promqlExperimentalFunctions)
			}
		}
	}

	tripperWare, err := queryfrontend.NewTripperware(cfg.Config, reg, logger)
	if err != nil {
		return errors.Wrap(err, "setup tripperwares")

View on GitHub (pinned to 35b8b99117)