{"record":{"id":"bcd596049ae8f276","repo":"thanos-io/thanos","slug":"initializing-the-query-range-cache-config","errorCode":null,"errorMessage":"initializing the query range cache config","messagePattern":"initializing the query range cache config","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/thanos/query_frontend.go","lineNumber":278,"sourceCode":"\t\t}\n\n\t\tcfg.orgIdHeaders = append(cfg.orgIdHeaders, cfg.TenantHeader)\n\t}\n\n\t// Temporarily manually adding the default tenant header into the list of headers to forward and org id headers.\n\t// This facilitates the transition from org id to tenant id with minimal amount of changes.\n\tcfg.ForwardHeaders = append(cfg.ForwardHeaders, tenancy.DefaultTenantHeader)\n\t// TODO: This should be removed once the org id header is fully removed in Thanos.\n\tcfg.orgIdHeaders = append(cfg.orgIdHeaders, tenancy.DefaultTenantHeader)\n\n\tqueryRangeCacheConfContentYaml, err := cfg.QueryRangeConfig.CachePathOrContent.Content()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(queryRangeCacheConfContentYaml) > 0 {\n\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{","sourceCodeStart":260,"sourceCodeEnd":296,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/cmd/thanos/query_frontend.go#L260-L296","documentation":"This error wraps failures from queryfrontend.NewCacheConfig when parsing the query-range results cache YAML (via --query-range-cache-config-file or inline content). NewCacheConfig validates backend type (in-memory, memcached, redis) and its options. Thanos wraps it to indicate the query-range cache config specifically failed.","triggerScenarios":"Supplying a query-range cache config YAML that is invalid: unknown backend type, missing backend options, wrong field types, or unparseable YAML.","commonSituations":"Mixing Cortex cache schemas across versions, memcached addresses left empty, redis config copied from another component with unsupported fields, or YAML syntax errors.","solutions":["Check the wrapped underlying error for the exact field/type failure.","Validate the cache backend type is one of the supported values (in-memory, memcached, redis).","Validate YAML syntax and field types against the CacheConfig schema.","Test the same YAML with a minimal Thanos setup before deploying."],"exampleFix":"// before\nmemory:\n  max_size_items: 0\ntype: memcached-doesnotexist\n// after\nmemcached:\n  addresses: [dnssrvnoa+memcached:11211]\ntype: memcached","handlingStrategy":"validation","validationCode":"type cacheProbe struct {\n  Type string `yaml:\"type\"`\n}\nvar p cacheProbe\nif err := yaml.Unmarshal(yamlContent, &p); err != nil || p.Type == \"\" {\n  return errors.New(\"cache config needs a valid 'type' field\")\n}","typeGuard":null,"tryCatchPattern":"if _, err := queryfrontend.NewCacheConfig(logger, yamlContent); err != nil {\n  log.Fatalf(\"query range cache config invalid: %v\", err)\n}","preventionTips":["Use a known-good cache YAML from your deploy templates","Match the schema for your exact Thanos version","Validate backend options (memcached addresses etc.) exist"],"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"}