thanos-io/thanos · error
invalid ResultsCache config
Error message
invalid ResultsCache config
What it means
This is the wrapper message produced by errors.Wrap(err, "invalid ResultsCache config") inside queryrange Config.Validate when the nested ResultsCacheConfig.Validate fails. The final error text is "invalid ResultsCache config: <underlying reason>", e.g. an unsupported compression value or the cache-queryable-samples-stats combination error.
Solutions
- Read the wrapped cause after the colon — fix the underlying ResultsCacheConfig issue (e.g. compression value)
- Validate the results-cache section independently against supported values
- Align flags referenced by nested validation (per-step-stats-enabled, cache config backends)
Example fix
# before
querier:
results-cache:
compression: gzip
# after
querier:
results-cache:
compression: snappy Defensive patterns
Strategy: try-catch
Try / catch
if err := cfg.Validate(qCfg); err != nil {
var wrapped error
if errors.As(err, &wrapped) || strings.Contains(err.Error(), "invalid ResultsCache config") {
log.Errorf("results cache section invalid: %v", errors.Unwrap(err))
}
} Prevention
- Always inspect the full wrapped error chain, not just the top message
- Validate the results-cache subsection separately during config CI
- Keep compression and dependent flags within documented values
When it happens
Trigger: Calling queryrange Config.Validate with cache_results=true and any invalid nested results-cache setting: bad compression, cache-queryable-samples-stats without per-step stats, or invalid embedded CacheConfig.
Common situations: Compound config validation failures at startup where the root cause is in the results-cache section; debugging sessions that only see the wrapper unless the full wrapped error chain is logged.
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
- unsupported compression type
- frontend.cache-queryable-samples-stats may only be enabled…
- a non-zero value is required for…
- querier.cache-results may only be enabled in conjunction…
- unsupported format for label
AI-assisted analysis of thanos-io/thanos@35b8b99117 (2026-09-07).
Data as JSON: /api/errors/48202c138df04fb9.
Report an issue: GitHub.
Appendix: source
Thrown at internal/cortex/querier/queryrange/roundtrip.go:75
type Config struct {
SplitQueriesByInterval time.Duration `yaml:"split_queries_by_interval"`
AlignQueriesWithStep bool `yaml:"align_queries_with_step"`
ResultsCacheConfig `yaml:"results_cache"`
CacheResults bool `yaml:"cache_results"`
MaxRetries int `yaml:"max_retries"`
ShardedQueries bool `yaml:"parallelise_shardable_queries"`
// List of headers which query_range middleware chain would forward to downstream querier.
ForwardHeaders flagext.StringSlice `yaml:"forward_headers_list"`
}
// Validate validates the config.
func (cfg *Config) Validate(qCfg querier.Config) error {
if cfg.CacheResults {
if cfg.SplitQueriesByInterval <= 0 {
return errors.New("querier.cache-results may only be enabled in conjunction with querier.split-queries-by-interval. Please set the latter")
}
if err := cfg.ResultsCacheConfig.Validate(qCfg); err != nil {
return errors.Wrap(err, "invalid ResultsCache config")
}
}
return nil
}
// HandlerFunc is like http.HandlerFunc, but for Handler.
type HandlerFunc func(context.Context, Request) (Response, error)
// Do implements Handler.
func (q HandlerFunc) Do(ctx context.Context, req Request) (Response, error) {
return q(ctx, req)
}
// Handler is like http.Handle, but specifically for Prometheus query_range calls.
type Handler interface {
Do(context.Context, Request) (Response, error)
}
View on GitHub (pinned to 35b8b99117)