{"record":{"id":"d0307183add35446","repo":"thanos-io/thanos","slug":"failed-to-create-groupcache","errorCode":null,"errorMessage":"failed to create groupcache","messagePattern":"failed to create groupcache","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/store/cache/caching_bucket_factory.go","lineNumber":128,"sourceCode":"\tswitch strings.ToUpper(string(config.Type)) {\n\tcase string(MemcachedBucketCacheProvider):\n\t\tvar memcached cacheutil.RemoteCacheClient\n\t\tmemcached, err := cacheutil.NewMemcachedClient(logger, \"caching-bucket\", backendConfig, reg)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"failed to create memcached client\")\n\t\t}\n\t\tc = cache.NewMemcachedCache(\"caching-bucket\", logger, memcached, reg)\n\tcase string(InMemoryBucketCacheProvider):\n\t\tc, err = cache.NewInMemoryCache(\"caching-bucket\", logger, reg, backendConfig)\n\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 {","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/store/cache/caching_bucket_factory.go#L110-L146","documentation":"When the cache type is GROUPCACHE, the factory initializes a groupcache instance via cache.NewGroupcache using a base HTTP path (/_galaxycache/); failures are wrapped as 'failed to create groupcache'. Groupcache ties into the provided HTTP router and bucket, so registration problems surface here.","triggerScenarios":"CachingWithBackendConfig.Type == GROUPCACHE and NewGroupcache returns an error — commonly invalid groupcache config in backendConfig, conflicts registering the /_galaxycache/ path on the provided route.Router, or a nil bucket/router dependency.","commonSituations":"Running a component where the passed router already serves the same path, groupcache options mis-sized (max bytes per group), or attempting groupcache in a Thanos build/component that does not support it.","solutions":["Check the wrapped inner error for the exact registration/config failure","Ensure no other handler is registered on the groupcache base path /_galaxycache/","Validate groupcache options (peers, max group bytes) in the backend config","Confirm your Thanos version supports the GROUPCACHE provider for this component","Switch to MEMCACHED or REDIS if groupcache is not supported in your deployment"],"exampleFix":"// before\ncacheConfig:\n  type: GROUPCACHE\n  groupcache:\n    maxsize: \"abc\"   # unparseable size\n// after\ncacheConfig:\n  type: GROUPCACHE\n  groupcache:\n    maxsize: 1GB","handlingStrategy":"validation","validationCode":"if router == nil || bucket == nil { return errors.New(\"groupcache requires a non-nil router and bucket\") }\nif h := router.Get(\"/_galaxycache/\"); h != nil { return errors.New(\"path /_galaxycache/ already registered\") }","typeGuard":null,"tryCatchPattern":"cb, err := storecache.NewCachingBucketFromYaml(yamlContent, logger, reg, bucket, router)\nif err != nil {\n    if strings.Contains(err.Error(), \"failed to create groupcache\") {\n        return fmt.Errorf(\"groupcache init failed (check path conflict and groupcache config): %w\", err)\n    }\n    return err\n}","preventionTips":["Reserve /_galaxycache/ exclusively for groupcache on the router","Validate groupcache size options (e.g. 1GB) parse correctly","Confirm GROUPCACHE is supported in your Thanos build/component"],"tags":["go","groupcache","thanos","http-router"],"backgroundTag":"module-init-failed","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"}