{"record":{"id":"7bae25ac94fe7435","repo":"grpc/grpc-go","slug":"max-ring-size-value-of-d-is-greater-than-max-supp","errorCode":null,"errorMessage":"max_ring_size value of %d is greater than max supported value %d for this field","messagePattern":"max_ring_size value of (.+?) is greater than max supported value (.+?) for this field","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"balancer/ringhash/config.go","lineNumber":46,"sourceCode":"\tiringhash \"google.golang.org/grpc/internal/ringhash\"\n)\n\nconst (\n\tdefaultMinSize         = 1024\n\tdefaultMaxSize         = 4096\n\tringHashSizeUpperBound = 8 * 1024 * 1024 // 8M\n)\n\nfunc parseConfig(c json.RawMessage) (*iringhash.LBConfig, error) {\n\tvar cfg iringhash.LBConfig\n\tif err := json.Unmarshal(c, &cfg); err != nil {\n\t\treturn nil, err\n\t}\n\tif cfg.MinRingSize > ringHashSizeUpperBound {\n\t\treturn nil, fmt.Errorf(\"min_ring_size value of %d is greater than max supported value %d for this field\", cfg.MinRingSize, ringHashSizeUpperBound)\n\t}\n\tif cfg.MaxRingSize > ringHashSizeUpperBound {\n\t\treturn nil, fmt.Errorf(\"max_ring_size value of %d is greater than max supported value %d for this field\", cfg.MaxRingSize, ringHashSizeUpperBound)\n\t}\n\tif cfg.MinRingSize == 0 {\n\t\tcfg.MinRingSize = defaultMinSize\n\t}\n\tif cfg.MaxRingSize == 0 {\n\t\tcfg.MaxRingSize = defaultMaxSize\n\t}\n\tif cfg.MinRingSize > cfg.MaxRingSize {\n\t\treturn nil, fmt.Errorf(\"min %v is greater than max %v\", cfg.MinRingSize, cfg.MaxRingSize)\n\t}\n\tif cfg.MinRingSize > envconfig.RingHashCap {\n\t\tcfg.MinRingSize = envconfig.RingHashCap\n\t}\n\tif cfg.MaxRingSize > envconfig.RingHashCap {\n\t\tcfg.MaxRingSize = envconfig.RingHashCap\n\t}\n\tif !envconfig.RingHashSetRequestHashKey {\n\t\tcfg.RequestHashHeader = \"\"","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/grpc/grpc-go/blob/03255a9237b6eb32710f6bc4f2de9a675b99fe36/balancer/ringhash/config.go#L28-L64","documentation":"Returned by ringhash.parseConfig (config.go:45-47) when MaxRingSize exceeds ringHashSizeUpperBound (8M). Same memory-cap rationale as MinRingSize. The %d values are the offending value and the 8M bound.","triggerScenarios":"The ring_hash config sets maxRingSize above 8388608.","commonSituations":"Unit confusion (treating the field as bytes), xDS control-plane misconfiguration, or attempting to maximize distribution without realizing the hard cap.","solutions":["Set maxRingSize to at most 8388608; default is 4096 and rarely needs to be larger.","Verify the xDS Cluster.ringHashLbConfig.maximumRingSize value in the control plane."],"exampleFix":"// before\nraw := `{\"minRingSize\": 1024, \"maxRingSize\": 100000000}` // > 8M -> error\n\n// after\nraw := `{\"minRingSize\": 1024, \"maxRingSize\": 4096}`","handlingStrategy":"validation","validationCode":"const ringHashUpperBound = 8 * 1024 * 1024\nfunc validateMaxRingSize(raw []byte) error {\n    var c struct{ MaxRingSize uint64 `json:\"maxRingSize\"` }\n    _ = json.Unmarshal(raw, &c)\n    if c.MaxRingSize > ringHashUpperBound {\n        return fmt.Errorf(\"maxRingSize %d > %d\", c.MaxRingSize, ringHashUpperBound)\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Same as minRingSize: small thousands are plenty.","Lint the config in CI to reject values above the 8M cap."],"tags":["go","grpc","load-balancing","ring-hash","config"],"analyzedSha":"03255a9237b6eb32710f6bc4f2de9a675b99fe36","analyzedAt":"2026-08-07T00:29:34.215Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}