grpc/grpc-go · error
min_ring_size value of
Error message
min_ring_size value of %d is greater than max supported value %d for this field
What it means
Returned by ringhash's parseConfig() (balancer/ringhash/config.go:43) when MinRingSize exceeds ringHashSizeUpperBound (8 * 1024 * 1024 = 8388608). The ring is an in-memory hash ring of SubConn entries; an enormous ring would consume excessive memory, so it is hard-capped at 8M entries.
Solutions
- Set minRingSize to a value <= 8388608 (8M).
- Use the defaults (defaultMinSize = 1024) unless you have a measured need for more.
- Prefer maxRingSize tuning over inflating minRingSize.
Example fix
// before: minRingSize beyond the hard cap
grpc.WithDefaultServiceConfig(`{"loadBalancingConfig":[{"ring_hash_experimental":{"minRingSize":100000000}}]}`)
// after: within the supported range (or omit for default 1024)
grpc.WithDefaultServiceConfig(`{"loadBalancingConfig":[{"ring_hash_experimental":{"minRingSize":1024,"maxRingSize":4096}}]}`) Defensive patterns
Strategy: validation
Validate before calling
const ringHashUpperBound = 8 * 1024 * 1024
func validateMinRingSize(min uint64) error {
if min > ringHashUpperBound {
return fmt.Errorf("minRingSize %d exceeds max %d", min, ringHashUpperBound)
}
return nil
} Prevention
- Cap minRingSize at 8388608 in config generation / xDS policy validators.
- Prefer defaults unless you have measured the need for a larger ring.
When it happens
Trigger: The ring_hash_experimental config sets minRingSize to a value > 8388608. json.Unmarshal succeeds, then the check at line 42 fails.
Common situations: A very large minRingSize requested (e.g. from an xDS control plane) to maximize distribution accuracy without understanding the memory cost; a config typo adding extra zeros.
Related errors
- max_ring_size value of
- min is greater than max
- invalid requestHashHeader
- invalid requestHashHeader
- least-request: lbConfig.choiceCount
AI-assisted analysis of grpc/grpc-go@0c51461d27 (2026-08-11).
Data as JSON: /api/errors/82d0010d01d897f7.
Report an issue: GitHub.
Appendix: source
Thrown at balancer/ringhash/config.go:43
"google.golang.org/grpc/internal/envconfig"
"google.golang.org/grpc/internal/metadata"
iringhash "google.golang.org/grpc/internal/ringhash"
)
const (
defaultMinSize = 1024
defaultMaxSize = 4096
ringHashSizeUpperBound = 8 * 1024 * 1024 // 8M
)
func parseConfig(c json.RawMessage) (*iringhash.LBConfig, error) {
var cfg iringhash.LBConfig
if err := json.Unmarshal(c, &cfg); err != nil {
return nil, err
}
if cfg.MinRingSize > ringHashSizeUpperBound {
return nil, fmt.Errorf("min_ring_size value of %d is greater than max supported value %d for this field", cfg.MinRingSize, ringHashSizeUpperBound)
}
if cfg.MaxRingSize > ringHashSizeUpperBound {
return nil, fmt.Errorf("max_ring_size value of %d is greater than max supported value %d for this field", cfg.MaxRingSize, ringHashSizeUpperBound)
}
if cfg.MinRingSize == 0 {
cfg.MinRingSize = defaultMinSize
}
if cfg.MaxRingSize == 0 {
cfg.MaxRingSize = defaultMaxSize
}
if cfg.MinRingSize > cfg.MaxRingSize {
return nil, fmt.Errorf("min %v is greater than max %v", cfg.MinRingSize, cfg.MaxRingSize)
}
if cfg.MinRingSize > envconfig.RingHashCap {
cfg.MinRingSize = envconfig.RingHashCap
}
if cfg.MaxRingSize > envconfig.RingHashCap {
cfg.MaxRingSize = envconfig.RingHashCapView on GitHub (pinned to 0c51461d27)