{"record":{"id":"1ed198b631a1fc61","repo":"thanos-io/thanos","slug":"use-of-multiple-cache-storage-systems-is-not-suppo","errorCode":null,"errorMessage":"use of multiple cache storage systems is not supported","messagePattern":"use of multiple cache storage systems is not supported","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cortex/chunk/cache/cache.go","lineNumber":86,"sourceCode":"func New(cfg Config, reg prometheus.Registerer, logger log.Logger) (Cache, error) {\n\tif cfg.Cache != nil {\n\t\treturn cfg.Cache, nil\n\t}\n\n\tcaches := []Cache{}\n\n\tif cfg.EnableFifoCache {\n\t\tif cfg.Fifocache.Validity == 0 && cfg.DefaultValidity != 0 {\n\t\t\tcfg.Fifocache.Validity = cfg.DefaultValidity\n\t\t}\n\n\t\tif cache := NewFifoCache(cfg.Prefix+\"fifocache\", cfg.Fifocache, reg, logger); cache != nil {\n\t\t\tcaches = append(caches, Instrument(cfg.Prefix+\"fifocache\", cache, reg))\n\t\t}\n\t}\n\n\tif (cfg.MemcacheClient.Host != \"\" || cfg.MemcacheClient.Addresses != \"\") && cfg.Redis.Endpoint != \"\" {\n\t\treturn nil, errors.New(\"use of multiple cache storage systems is not supported\")\n\t}\n\n\tif cfg.MemcacheClient.Host != \"\" || cfg.MemcacheClient.Addresses != \"\" {\n\t\tif cfg.Memcache.Expiration == 0 && cfg.DefaultValidity != 0 {\n\t\t\tcfg.Memcache.Expiration = cfg.DefaultValidity\n\t\t}\n\n\t\tclient := NewMemcachedClient(cfg.MemcacheClient, cfg.Prefix, reg, logger)\n\t\tcache := NewMemcached(cfg.Memcache, client, cfg.Prefix, reg, logger)\n\n\t\tcacheName := cfg.Prefix + \"memcache\"\n\t\tcaches = append(caches, NewBackground(cacheName, cfg.Background, Instrument(cacheName, cache, reg), reg))\n\t}\n\n\tif cfg.Redis.Endpoint != \"\" {\n\t\tif cfg.Redis.Expiration == 0 && cfg.DefaultValidity != 0 {\n\t\t\tcfg.Redis.Expiration = cfg.DefaultValidity\n\t\t}","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/internal/cortex/chunk/cache/cache.go#L68-L104","documentation":"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.","triggerScenarios":"Calling New() (via NewResultsCacheMiddleware) with cfg.MemcacheClient.Host or cfg.MemcacheClient.Addresses set AND cfg.Redis.Endpoint set at the same time.","commonSituations":"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.","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."],"exampleFix":"// before\nmemcache_client:\n  host: memcached:11211\nredis:\n  endpoint: redis:6379\n// after\nredis:\n  endpoint: redis:6379","handlingStrategy":"validation","validationCode":"if (cfg.MemcacheClient.Host != \"\" || cfg.MemcacheClient.Addresses != \"\") && cfg.Redis.Endpoint != \"\" {\n    return errors.New(\"only one cache backend (memcached or redis) may be configured\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["config","cache","cortex"],"backgroundTag":"conflicting-config-options","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"}