{"record":{"id":"65138bc395e5db9e","repo":"thanos-io/thanos","slug":"initializing-the-labels-cache-config","errorCode":null,"errorMessage":"initializing the labels cache config","messagePattern":"initializing the labels cache config","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/thanos/query_frontend.go","lineNumber":294,"sourceCode":"\t\tcacheConfig, err := queryfrontend.NewCacheConfig(logger, queryRangeCacheConfContentYaml)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"initializing the query range cache config\")\n\t\t}\n\t\tcfg.QueryRangeConfig.ResultsCacheConfig = &queryrange.ResultsCacheConfig{\n\t\t\tCompression:                cfg.CacheCompression,\n\t\t\tCacheConfig:                *cacheConfig,\n\t\t\tCacheQueryableSamplesStats: cfg.CortexHandlerConfig.QueryStatsEnabled,\n\t\t}\n\t}\n\n\tlabelsCacheConfContentYaml, err := cfg.LabelsConfig.CachePathOrContent.Content()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(labelsCacheConfContentYaml) > 0 {\n\t\tcacheConfig, err := queryfrontend.NewCacheConfig(logger, labelsCacheConfContentYaml)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"initializing the labels cache config\")\n\t\t}\n\t\tcfg.LabelsConfig.ResultsCacheConfig = &queryrange.ResultsCacheConfig{\n\t\t\tCompression: cfg.CacheCompression,\n\t\t\tCacheConfig: *cacheConfig,\n\t\t}\n\t}\n\n\tif err := cfg.Validate(); err != nil {\n\t\treturn errors.Wrap(err, \"error validating the config\")\n\t}\n\n\tif cfg.EnableXFunctions {\n\t\tmaps.Copy(parser.Functions, parse.XFunctions)\n\t}\n\n\tif len(cfg.EnableFeatures) > 0 {\n\t\tfor _, feature := range cfg.EnableFeatures {\n\t\t\tif feature == promqlExperimentalFunctions {","sourceCodeStart":276,"sourceCodeEnd":312,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/cmd/thanos/query_frontend.go#L276-L312","documentation":"Identical to the query-range cache failure but for the labels cache: errors from queryfrontend.NewCacheConfig on the labels cache YAML (via --labels-cache-config-file or inline content) are wrapped with this message. It means the labels cache backend configuration could not be built.","triggerScenarios":"Providing a labels cache config YAML with an invalid backend type, missing memcached/redis options, wrong field types, or malformed YAML.","commonSituations":"Copy-pasting the query-range cache YAML into the labels cache flag with fields the schema rejects, or leaving default example content with placeholder addresses.","solutions":["Read the wrapped underlying error to find the offending key.","Ensure backend type is supported and required options (e.g. memcached addresses) are set.","Validate the YAML against the CacheConfig schema for the Thanos version in use.","Decouple the two configs: fix the labels cache YAML separately from the query-range cache YAML."],"exampleFix":"// before\ntype: memcached\n// after\ntype: memcached\nmemcached:\n  addresses: [dnssrvnoa+memcached:11211]","handlingStrategy":"validation","validationCode":"if !backendKnown(labelsCacheYAML) {\n  return errors.New(\"labels cache config: unknown or missing backend type\")\n}","typeGuard":null,"tryCatchPattern":"if _, err := queryfrontend.NewCacheConfig(logger, labelsCacheYAML); err != nil {\n  log.Fatalf(\"labels cache config invalid: %v\", err)\n}","preventionTips":["Don't reuse query-range cache YAML verbatim for labels cache","Fill in all required backend fields","Lint YAML before rollout"],"tags":["config","cache","yaml"],"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"}