thanos-io/thanos · error
use of multiple cache storage systems is not supported
Error message
use of multiple cache storage systems is not supported
What it means
New() in the cortex chunk cache package rejects configurations that configure more than one remote cache backend. It supports at most one of memcached or Redis; configuring both memcached and a Redis endpoint makes the tiered cache ambiguous, so construction fails fast with this error.
Solutions
- Remove the memcached section (memcache_client.host / memcache_client.addresses) from the config, keeping only redis.endpoint.
- Alternatively remove the redis section if memcached is the intended backend.
- Validate the effective config before startup so only one cache backend is populated.
Example fix
// before memcache_client: host: memcached:11211 redis: endpoint: redis:6379 // after redis: endpoint: redis:6379
Defensive patterns
Strategy: validation
Validate before calling
if (cfg.MemcacheClient.Host != "" || cfg.MemcacheClient.Addresses != "") && cfg.Redis.Endpoint != "" {
return errors.New("only one cache backend (memcached or redis) may be configured")
} Prevention
- Keep exactly one cache backend section populated in config templates.
- Run Validate() on the cache config in CI before deploys.
- When migrating backends, remove the old section in the same change.
When it happens
Trigger: Calling New() (via NewResultsCacheMiddleware) with cfg.MemcacheClient.Host or cfg.MemcacheClient.Addresses set AND cfg.Redis.Endpoint set at the same time.
Common situations: Migrating from memcached to Redis while leaving the old memcached host/addresses in the YAML config; merging two teams' cache config blocks; copying a sample config that includes both sections.
Understand the failure class
Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.
Related errors
- unsupported compression type
- querier.cache-results may only be enabled in conjunction…
- initializing the query range cache config
- initializing the labels cache config
- invalid FifoCache config
AI-assisted analysis of thanos-io/thanos@35b8b99117 (2026-09-07).
Data as JSON: /api/errors/1ed198b631a1fc61.
Report an issue: GitHub.
Appendix: source
Thrown at internal/cortex/chunk/cache/cache.go:86
func New(cfg Config, reg prometheus.Registerer, logger log.Logger) (Cache, error) {
if cfg.Cache != nil {
return cfg.Cache, nil
}
caches := []Cache{}
if cfg.EnableFifoCache {
if cfg.Fifocache.Validity == 0 && cfg.DefaultValidity != 0 {
cfg.Fifocache.Validity = cfg.DefaultValidity
}
if cache := NewFifoCache(cfg.Prefix+"fifocache", cfg.Fifocache, reg, logger); cache != nil {
caches = append(caches, Instrument(cfg.Prefix+"fifocache", cache, reg))
}
}
if (cfg.MemcacheClient.Host != "" || cfg.MemcacheClient.Addresses != "") && cfg.Redis.Endpoint != "" {
return nil, errors.New("use of multiple cache storage systems is not supported")
}
if cfg.MemcacheClient.Host != "" || cfg.MemcacheClient.Addresses != "" {
if cfg.Memcache.Expiration == 0 && cfg.DefaultValidity != 0 {
cfg.Memcache.Expiration = cfg.DefaultValidity
}
client := NewMemcachedClient(cfg.MemcacheClient, cfg.Prefix, reg, logger)
cache := NewMemcached(cfg.Memcache, client, cfg.Prefix, reg, logger)
cacheName := cfg.Prefix + "memcache"
caches = append(caches, NewBackground(cacheName, cfg.Background, Instrument(cacheName, cache, reg), reg))
}
if cfg.Redis.Endpoint != "" {
if cfg.Redis.Expiration == 0 && cfg.DefaultValidity != 0 {
cfg.Redis.Expiration = cfg.DefaultValidity
}View on GitHub (pinned to 35b8b99117)