{"record":{"id":"48202c138df04fb9","repo":"thanos-io/thanos","slug":"invalid-resultscache-config","errorCode":null,"errorMessage":"invalid ResultsCache config","messagePattern":"invalid ResultsCache config","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cortex/querier/queryrange/roundtrip.go","lineNumber":75,"sourceCode":"type Config struct {\n\tSplitQueriesByInterval time.Duration `yaml:\"split_queries_by_interval\"`\n\tAlignQueriesWithStep   bool          `yaml:\"align_queries_with_step\"`\n\tResultsCacheConfig     `yaml:\"results_cache\"`\n\tCacheResults           bool `yaml:\"cache_results\"`\n\tMaxRetries             int  `yaml:\"max_retries\"`\n\tShardedQueries         bool `yaml:\"parallelise_shardable_queries\"`\n\t// List of headers which query_range middleware chain would forward to downstream querier.\n\tForwardHeaders flagext.StringSlice `yaml:\"forward_headers_list\"`\n}\n\n// Validate validates the config.\nfunc (cfg *Config) Validate(qCfg querier.Config) error {\n\tif cfg.CacheResults {\n\t\tif cfg.SplitQueriesByInterval <= 0 {\n\t\t\treturn errors.New(\"querier.cache-results may only be enabled in conjunction with querier.split-queries-by-interval. Please set the latter\")\n\t\t}\n\t\tif err := cfg.ResultsCacheConfig.Validate(qCfg); err != nil {\n\t\t\treturn errors.Wrap(err, \"invalid ResultsCache config\")\n\t\t}\n\t}\n\treturn nil\n}\n\n// HandlerFunc is like http.HandlerFunc, but for Handler.\ntype HandlerFunc func(context.Context, Request) (Response, error)\n\n// Do implements Handler.\nfunc (q HandlerFunc) Do(ctx context.Context, req Request) (Response, error) {\n\treturn q(ctx, req)\n}\n\n// Handler is like http.Handle, but specifically for Prometheus query_range calls.\ntype Handler interface {\n\tDo(context.Context, Request) (Response, error)\n}\n","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/internal/cortex/querier/queryrange/roundtrip.go#L57-L93","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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)"],"exampleFix":"# before\nquerier:\n  results-cache:\n    compression: gzip\n# after\nquerier:\n  results-cache:\n    compression: snappy","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := cfg.Validate(qCfg); err != nil {\n\tvar wrapped error\n\tif errors.As(err, &wrapped) || strings.Contains(err.Error(), \"invalid ResultsCache config\") {\n\t\tlog.Errorf(\"results cache section invalid: %v\", errors.Unwrap(err))\n\t}\n}","preventionTips":["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"],"tags":["config","validation","error-wrapping","cortex"],"backgroundTag":"invalid-config-value","analyzedSha":"35b8b991177def87ed52dcf10f9b6d87f07282c8","analyzedAt":"2026-09-07T01:49:59.689Z","contentChangedAt":"2026-09-07T01:49:59.689Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}