thanos-io/thanos · error
failed to create groupcache
Error message
failed to create groupcache
What it means
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.
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
Example fix
// before
cacheConfig:
type: GROUPCACHE
groupcache:
maxsize: "abc" # unparseable size
// after
cacheConfig:
type: GROUPCACHE
groupcache:
maxsize: 1GB Defensive patterns
Strategy: validation
Validate before calling
if router == nil || bucket == nil { return errors.New("groupcache requires a non-nil router and bucket") }
if h := router.Get("/_galaxycache/"); h != nil { return errors.New("path /_galaxycache/ already registered") } Try / catch
cb, err := storecache.NewCachingBucketFromYaml(yamlContent, logger, reg, bucket, router)
if err != nil {
if strings.Contains(err.Error(), "failed to create groupcache") {
return fmt.Errorf("groupcache init failed (check path conflict and groupcache config): %w", err)
}
return err
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- failed to parse template
- failed to execute template
- failed to parse the template
- failed to execute the template
- scrape manager not ready
AI-assisted analysis of thanos-io/thanos@35b8b99117 (2026-09-07).
Data as JSON: /api/errors/d0307183add35446.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/store/cache/caching_bucket_factory.go:128
switch strings.ToUpper(string(config.Type)) {
case string(MemcachedBucketCacheProvider):
var memcached cacheutil.RemoteCacheClient
memcached, err := cacheutil.NewMemcachedClient(logger, "caching-bucket", backendConfig, reg)
if err != nil {
return nil, errors.Wrapf(err, "failed to create memcached client")
}
c = cache.NewMemcachedCache("caching-bucket", logger, memcached, reg)
case string(InMemoryBucketCacheProvider):
c, err = cache.NewInMemoryCache("caching-bucket", logger, reg, backendConfig)
if err != nil {
return nil, errors.Wrapf(err, "failed to create inmemory cache")
}
case string(GroupcacheBucketCacheProvider):
const basePath = "/_galaxycache/"
c, err = cache.NewGroupcache(logger, reg, backendConfig, basePath, r, bucket, cfg)
if err != nil {
return nil, errors.Wrap(err, "failed to create groupcache")
}
case string(RedisBucketCacheProvider):
redisCache, err := cacheutil.NewRedisClient(logger, "caching-bucket", backendConfig, reg)
if err != nil {
return nil, errors.Wrapf(err, "failed to create redis client")
}
c = cache.NewRedisCache("caching-bucket", logger, redisCache, reg)
default:
return nil, errors.Errorf("unsupported cache type: %s", config.Type)
}
// Include interactions with cache in the traces.
c = cache.NewTracingCache(c)
cfg.SetCacheImplementation(c)
cb, err := NewCachingBucket(bucket, cfg, logger, reg)
if err != nil {View on GitHub (pinned to 35b8b99117)