{"record":{"id":"1a53be6ea1ee3cad","repo":"thanos-io/thanos","slug":"unsupported-cache-type-s","errorCode":null,"errorMessage":"unsupported cache type: %s","messagePattern":"unsupported cache type: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/store/cache/caching_bucket_factory.go","lineNumber":138,"sourceCode":"\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"failed to create inmemory cache\")\n\t\t}\n\tcase string(GroupcacheBucketCacheProvider):\n\t\tconst basePath = \"/_galaxycache/\"\n\n\t\tc, err = cache.NewGroupcache(logger, reg, backendConfig, basePath, r, bucket, cfg)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"failed to create groupcache\")\n\t\t}\n\n\tcase string(RedisBucketCacheProvider):\n\t\tredisCache, err := cacheutil.NewRedisClient(logger, \"caching-bucket\", backendConfig, reg)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"failed to create redis client\")\n\t\t}\n\t\tc = cache.NewRedisCache(\"caching-bucket\", logger, redisCache, reg)\n\tdefault:\n\t\treturn nil, errors.Errorf(\"unsupported cache type: %s\", config.Type)\n\t}\n\n\t// Include interactions with cache in the traces.\n\tc = cache.NewTracingCache(c)\n\tcfg.SetCacheImplementation(c)\n\n\tcb, err := NewCachingBucket(bucket, cfg, logger, reg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn cb, nil\n}\n\nvar chunksMatcher = regexp.MustCompile(`^.*/chunks/\\d+$`)\n\nfunc isTSDBChunkFile(name string) bool { return chunksMatcher.MatchString(name) }\n","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/store/cache/caching_bucket_factory.go#L120-L156","documentation":"After trying MEMCACHED, IN-MEMORY, GROUPCACHE and REDIS providers, any other config.Type value hits the default branch and yields errors.Errorf(\"unsupported cache type: %s\"). The library throws it because the cache type string must match one of the supported BucketCacheProvider constants.","triggerScenarios":"NewCachingBucketFromYaml given YAML whose cache config 'type' is not exactly one of MEMCACHED, IN-MEMORY, GROUPCACHE, REDIS (matching is case-sensitive via strings.ToUpper on config.Type — a misspelling or unknown provider triggers this).","commonSituations":"Typos like 'inmemory', 'memcache', or lowercase variants stored oddly, using a provider introduced in a newer Thanos than the one deployed, or copying config from another project (e.g. Cortex) with different type names.","solutions":["Set type to one of the supported values: MEMCACHED, IN-MEMORY, GROUPCACHE, REDIS (uppercase)","Check the error message: it echoes the offending type string for comparison","Confirm your Thanos version supports the type you want (check BucketCacheProvider constants)","Compare against examples in Thanos docs/caching_bucket.md","Note the switch uppercases the type, so a correct-name-but-wrong-spelling is still rejected"],"exampleFix":"// before\nconfig:\n  caches:\n    chunks:\n      type: inmemory   # not an exact supported constant\n// after\nconfig:\n  caches:\n    chunks:\n      type: IN-MEMORY","handlingStrategy":"validation","validationCode":"var probe struct { Config struct { Caches map[string]struct{ Type string `yaml:\"type\"` } `yaml:\"caches\"` } `yaml:\"config\"` }\nif err := yaml.Unmarshal(yamlContent, &probe); err != nil { return err }\nfor name, c := range probe.Config.Caches {\n    switch c.Type {\n    case \"MEMCACHED\", \"IN-MEMORY\", \"GROUPCACHE\", \"REDIS\":\n    default:\n        return fmt.Errorf(\"cache %q: unsupported type %q\", name, c.Type)\n    }\n}","typeGuard":"func supportedCacheType(t string) bool {\n    switch t {\n    case \"MEMCACHED\", \"IN-MEMORY\", \"GROUPCACHE\", \"REDIS\":\n        return true\n    }\n    return false\n}","tryCatchPattern":"cb, err := storecache.NewCachingBucketFromYaml(yamlContent, logger, reg, bucket, router)\nif err != nil {\n    if strings.Contains(err.Error(), \"unsupported cache type\") {\n        return fmt.Errorf(\"use MEMCACHED, IN-MEMORY, GROUPCACHE or REDIS: %w\", err)\n    }\n    return err\n}","preventionTips":["Type must be exactly MEMCACHED, IN-MEMORY, GROUPCACHE or REDIS (uppercase)","Check provider constants for your Thanos version before adding a new type","Copy cache type values only from official Thanos docs/examples"],"tags":["go","config","enum","thanos"],"backgroundTag":"invalid-enum-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"}