thanos-io/thanos · error
index cache with type
Error message
index cache with type %s is not supported
What it means
NewIndexCache dispatches on cacheConfig.Type against the supported backends (in-memory, memcached, etc.) and throws this error in the default case when the requested cache type has no registered factory. It means the type string in the index cache configuration is not one of the supported enum values.
Solutions
- Set type to a supported value: in-memory, memcached, or redis (depending on version).
- Check the error message for the rejected value and compare to docs for your Thanos version.
- If redis support is missing, upgrade Thanos to a version that includes the redis cache backend.
Example fix
// before
index-cache:
type: redis-cluster
// after
index-cache:
type: redis
config:
addresses: ["redis:6379"] Defensive patterns
Strategy: validation
Validate before calling
valid := map[string]bool{"in-memory": true, "memcached": true, "redis": true}
var cfg struct{ Type string `yaml:"type"` }
if err := yaml.Unmarshal(confYaml, &cfg); err == nil && !valid[cfg.Type] {
return fmt.Errorf("unsupported index cache type %q; use in-memory, memcached or redis", cfg.Type)
} Try / catch
if _, err := storecache.NewIndexCache(logger, confYaml, reg); err != nil {
var unknown interface{ Error() string }
if strings.Contains(err.Error(), "is not supported") {
return fmt.Errorf("index-cache.type must be one of in-memory|memcached|redis: %w", err)
}
return err
} Prevention
- Whitelist cache type strings in your config CI.
- Verify supported types against your Thanos version before upgrades.
- Do not copy cache 'type' values from Cortex or other projects.
When it happens
Trigger: Passing an index-cache YAML with type set to an unknown value, e.g. type: redis in a build/version where redis is not compiled in, type: redis-cluster, a typo like in-memory-cache, or an empty type string.
Common situations: Copy-pasting cache config from another project (e.g. Cortex) that supports different cache types; upgrading/downgrading Thanos so a previously available backend disappears; typos in type name.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- initializing the query range cache config
- initializing the labels cache config
- invalid reload method
- use of multiple cache storage systems is not supported
- invalid FifoCache config
AI-assisted analysis of thanos-io/thanos@35b8b99117 (2026-09-07).
Data as JSON: /api/errors/bb656d14a2bee81d.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/store/cache/factory.go:75
var cache IndexCache
switch strings.ToUpper(string(cacheConfig.Type)) {
case string(INMEMORY):
cache, err = NewInMemoryIndexCache(logger, cacheMetrics, reg, backendConfig)
case string(MEMCACHED):
var memcached cacheutil.RemoteCacheClient
memcached, err = cacheutil.NewMemcachedClient(logger, "index-cache", backendConfig, reg)
if err == nil {
cache, err = NewRemoteIndexCache(logger, memcached, cacheMetrics, reg, cacheConfig.TTL)
}
case string(REDIS):
var redisCache cacheutil.RemoteCacheClient
redisCache, err = cacheutil.NewRedisClient(logger, "index-cache", backendConfig, reg)
if err == nil {
cache, err = NewRemoteIndexCache(logger, redisCache, cacheMetrics, reg, cacheConfig.TTL)
}
default:
return nil, errors.Errorf("index cache with type %s is not supported", cacheConfig.Type)
}
if err != nil {
return nil, errors.Wrap(err, fmt.Sprintf("create %s index cache", cacheConfig.Type))
}
cache = NewTracingIndexCache(string(cacheConfig.Type), cache)
if len(cacheConfig.EnabledItems) > 0 {
if err = ValidateEnabledItems(cacheConfig.EnabledItems); err != nil {
return nil, err
}
cache = NewFilteredIndexCache(cache, cacheConfig.EnabledItems)
}
return cache, nil
}
View on GitHub (pinned to 35b8b99117)