thanos-io/thanos · error

query configuration

Error message

query configuration

What it means

This error wraps failures from clientconfig.LoadConfigs when loading the query API configuration YAML file for the Thanos Rule component. It is returned by runRule during startup before any query clients are created. The underlying error typically indicates the YAML file is unreadable or violates the endpoint config schema.

Solutions

  1. Validate the query config YAML parses (e.g. `yamllint` or a quick Go unmarshal into clientconfig.Config) before starting rule.
  2. Check the file path passed to --query.config-file exists and is readable by the rule process.
  3. Compare your YAML against the documented clientconfig.Config schema; remove or fix unknown/mistyped fields (especially http_config and endpoints).
  4. If mounted via Kubernetes Secret/ConfigMap, verify the mounted content was updated correctly.

Example fix

// before
query:
  config-file: /etc/thanos/query.yml
  # file content uses unknown key 'endpoitns'
// after
# /etc/thanos/query.yml
endpoints:
  - http://query-frontend:9090
Defensive patterns

Strategy: validation

Validate before calling

var probe []clientconfig.Config
if conf.queryConfigYAML != "" {
    if _, err := os.Stat(conf.queryConfigYAML); err != nil {
        return fmt.Errorf("query config file missing: %w", err)
    }
    if _, err := clientconfig.LoadConfigs([]string{conf.queryConfigYAML}); err != nil {
        return fmt.Errorf("query config invalid: %w", err)
    }
    _ = probe
}

Prevention

When it happens

Trigger: The --query.config-file (conf.queryConfigYAML) flag points to a file whose YAML fails to parse or fails schema validation inside clientconfig.LoadConfigs. Only taken when len(conf.queryConfigYAML) > 0.

Common situations: YAML typo (bad indentation), unknown field in the endpoints/httpConfig schema, file referenced by an environment variable that is empty, or a config file mounted in Kubernetes that is malformed or truncated.

Related errors


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

Appendix: source

Thrown at cmd/thanos/rule.go:345

	tracer opentracing.Tracer,
	comp component.Component,
	conf ruleConfig,
	reloadSignal <-chan struct{},
	flagsMap map[string]string,
	httpLogOpts []logging.Option,
	grpcLogOpts []grpc_logging.Option,
	logFilterMethods []string,
	tsdbOpts *tsdb.Options,
	agentOpts *agent.Options,
) error {
	metrics := newRuleMetrics(reg)

	var queryCfg []clientconfig.Config
	var err error
	if len(conf.queryConfigYAML) > 0 {
		queryCfg, err = clientconfig.LoadConfigs(conf.queryConfigYAML)
		if err != nil {
			return errors.Wrap(err, "query configuration")
		}
	} else {
		queryCfg, err = clientconfig.BuildConfigFromHTTPAddresses(conf.query.addrs)
		if err != nil {
			return errors.Wrap(err, "query configuration")
		}

		// Build the query configuration from the legacy query flags.
		var fileSDConfigs []clientconfig.HTTPFileSDConfig
		if len(conf.query.sdFiles) > 0 {
			fileSDConfigs = append(fileSDConfigs, clientconfig.HTTPFileSDConfig{
				Files:           conf.query.sdFiles,
				RefreshInterval: model.Duration(conf.query.sdInterval),
			})
			queryCfg = append(queryCfg,
				clientconfig.Config{
					HTTPConfig: clientconfig.HTTPConfig{
						EndpointsConfig: clientconfig.HTTPEndpointsConfig{

View on GitHub (pinned to 35b8b99117)