thanos-io/thanos · error

invalid ResultsCache config for labels tripperware

Error message

invalid ResultsCache config for labels tripperware

What it means

Validate() in pkg/queryfrontend checks that when the labels tripperware has a results cache configured, the cache's own configuration is valid. This error wraps any failure returned by ResultsCacheConfig.Validate(querier.Config{}), meaning the labels caching layer cannot start with the given cache settings. It exists to fail fast at config load time instead of at request time.

Solutions

  1. Read the wrapped inner error message to identify which cache field failed validation
  2. Fix the offending field in the labels results_cache config block (e.g. set a valid memcached/redis endpoint)
  3. If caching for labels is not wanted, remove the results_cache block from the labels config entirely so ResultsCacheConfig is nil
  4. Run cortex -config.file=... -config.expand-env with a config validation pass before deploying

Example fix

// before
labels:
  results_cache:
    backend: memcached
    memcached:
      # addresses missing
// after
labels:
  results_cache:
    backend: memcached
    memcached:
      addresses: [dnssrvnoa+memcached.{{.Release}}.svc:11211]
  split_queries_by_interval: 15m
Defensive patterns

Strategy: validation

Validate before calling

if cfg.LabelsConfig.ResultsCacheConfig != nil {
    if err := cfg.LabelsConfig.ResultsCacheConfig.Validate(querier.Config{}); err != nil {
        return fmt.Errorf("labels results cache config invalid: %w", err)
    }
}

Type guard

func hasLabelsCache(cfg Config) bool { return cfg.LabelsConfig.ResultsCacheConfig != nil }

Try / catch

if err := cfg.Validate(); err != nil {
    if strings.Contains(err.Error(), "invalid ResultsCache config for labels tripperware") {
        log.Fatalf("fix labels results_cache block: %v", err)
    }
}

Prevention

When it happens

Trigger: Config.Validate is called with cfg.LabelsConfig.ResultsCacheConfig non-nil and that nested config fails its own Validate (e.g. invalid backend endpoint, both memcached items and a conflicting backend set, missing cache backend).

Common situations: Operators enable query_results_cache for label endpoints (labels/series) but misconfigure the cache backend: bad memcached addresses, missing redis endpoint, cache config copied from another block with wrong field types after an upgrade.

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/66557bd790155eaf. Report an issue: GitHub.

Appendix: source

Thrown at pkg/queryfrontend/config.go:292

	}

	if cfg.isDynamicSplitSet() && cfg.isStaticSplitSet() {
		return errors.New("split queries interval and dynamic query split interval cannot be set at the same time")
	}

	if cfg.isDynamicSplitSet() {

		if err := cfg.validateDynamicSplitParams(); err != nil {
			return err
		}
	}

	if cfg.LabelsConfig.ResultsCacheConfig != nil {
		if cfg.LabelsConfig.SplitQueriesByInterval <= 0 {
			return errors.New("split queries interval should be greater than 0  when caching is enabled")
		}
		if err := cfg.LabelsConfig.ResultsCacheConfig.Validate(querier.Config{}); err != nil {
			return errors.Wrap(err, "invalid ResultsCache config for labels tripperware")
		}
	}

	if cfg.DefaultTimeRange == 0 {
		return errors.New("labels.default-time-range cannot be set to 0")
	}

	if cfg.DownstreamURL == "" {
		return errors.New("downstream URL should be configured")
	}

	return nil
}

func (cfg *Config) validateDynamicSplitParams() error {
	if cfg.HorizontalShards <= 0 {
		return errors.New("min horizontal shards should be greater than 0 when query split threshold is enabled")
	}

View on GitHub (pinned to 35b8b99117)