{"record":{"id":"66557bd790155eaf","repo":"thanos-io/thanos","slug":"invalid-resultscache-config-for-labels-tripperware","errorCode":null,"errorMessage":"invalid ResultsCache config for labels tripperware","messagePattern":"invalid ResultsCache config for labels tripperware","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/queryfrontend/config.go","lineNumber":292,"sourceCode":"\t}\n\n\tif cfg.isDynamicSplitSet() && cfg.isStaticSplitSet() {\n\t\treturn errors.New(\"split queries interval and dynamic query split interval cannot be set at the same time\")\n\t}\n\n\tif cfg.isDynamicSplitSet() {\n\n\t\tif err := cfg.validateDynamicSplitParams(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif cfg.LabelsConfig.ResultsCacheConfig != nil {\n\t\tif cfg.LabelsConfig.SplitQueriesByInterval <= 0 {\n\t\t\treturn errors.New(\"split queries interval should be greater than 0  when caching is enabled\")\n\t\t}\n\t\tif err := cfg.LabelsConfig.ResultsCacheConfig.Validate(querier.Config{}); err != nil {\n\t\t\treturn errors.Wrap(err, \"invalid ResultsCache config for labels tripperware\")\n\t\t}\n\t}\n\n\tif cfg.DefaultTimeRange == 0 {\n\t\treturn errors.New(\"labels.default-time-range cannot be set to 0\")\n\t}\n\n\tif cfg.DownstreamURL == \"\" {\n\t\treturn errors.New(\"downstream URL should be configured\")\n\t}\n\n\treturn nil\n}\n\nfunc (cfg *Config) validateDynamicSplitParams() error {\n\tif cfg.HorizontalShards <= 0 {\n\t\treturn errors.New(\"min horizontal shards should be greater than 0 when query split threshold is enabled\")\n\t}","sourceCodeStart":274,"sourceCodeEnd":310,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/queryfrontend/config.go#L274-L310","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Read the wrapped inner error message to identify which cache field failed validation","Fix the offending field in the labels results_cache config block (e.g. set a valid memcached/redis endpoint)","If caching for labels is not wanted, remove the results_cache block from the labels config entirely so ResultsCacheConfig is nil","Run cortex -config.file=... -config.expand-env with a config validation pass before deploying"],"exampleFix":"// before\nlabels:\n  results_cache:\n    backend: memcached\n    memcached:\n      # addresses missing\n// after\nlabels:\n  results_cache:\n    backend: memcached\n    memcached:\n      addresses: [dnssrvnoa+memcached.{{.Release}}.svc:11211]\n  split_queries_by_interval: 15m","handlingStrategy":"validation","validationCode":"if cfg.LabelsConfig.ResultsCacheConfig != nil {\n    if err := cfg.LabelsConfig.ResultsCacheConfig.Validate(querier.Config{}); err != nil {\n        return fmt.Errorf(\"labels results cache config invalid: %w\", err)\n    }\n}","typeGuard":"func hasLabelsCache(cfg Config) bool { return cfg.LabelsConfig.ResultsCacheConfig != nil }","tryCatchPattern":"if err := cfg.Validate(); err != nil {\n    if strings.Contains(err.Error(), \"invalid ResultsCache config for labels tripperware\") {\n        log.Fatalf(\"fix labels results_cache block: %v\", err)\n    }\n}","preventionTips":["Validate the config at deploy time (CI job running cortex config validation) before rollout","Keep labels cache config in sync with the query_range cache block, which is usually tested first","Use the same cache backend template for all tripperware cache blocks"],"tags":["config","validation","query-frontend","cache"],"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"}