{"record":{"id":"82d0010d01d897f7","repo":"grpc/grpc-go","slug":"min-ring-size-value-of-d-is-greater-than-max-supp","errorCode":null,"errorMessage":"min_ring_size value of %d is greater than max supported value %d for this field","messagePattern":"min_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":43,"sourceCode":"\n\t\"google.golang.org/grpc/internal/envconfig\"\n\t\"google.golang.org/grpc/internal/metadata\"\n\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","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/grpc/grpc-go/blob/03255a9237b6eb32710f6bc4f2de9a675b99fe36/balancer/ringhash/config.go#L25-L61","documentation":"Returned by ringhash.parseConfig (config.go:42-44) when MinRingSize exceeds ringHashSizeUpperBound (8*1024*1024 = 8M entries). The ring is an in-memory hash ring; an entry above 8M would consume excessive memory, so it is hard-capped. The %d values are the offending value and the 8M bound.","triggerScenarios":"The ring_hash LB config sets minRingSize to a value greater than 8388608 (often from an xDS message or a service config with an overly large or misplaced magnitude, e.g. confusing entries with bytes).","commonSituations":"Translating a desired cache size in bytes into ring entries by mistake. xDS control plane pushing a huge value due to a unit error. Copying a config tuned for a different scale.","solutions":["Lower minRingSize to at most 8388608; for most workloads a value in the low thousands (default is 1024) gives good distribution.","If you genuinely need very large rings for consistency-hash fan-out, reconsider: ring size governs distribution quality, not throughput, and defaults are usually adequate.","If sourced from xDS, check the Cluster ring_hash_lb_config fields in the control plane."],"exampleFix":"// before\nraw := `{\"minRingSize\": 16777216, \"maxRingSize\": 16777216}` // > 8M -> error\n\n// after\nraw := `{\"minRingSize\": 1024, \"maxRingSize\": 4096}`","handlingStrategy":"validation","validationCode":"const ringHashUpperBound = 8 * 1024 * 1024\nfunc validateMinRingSize(raw []byte) error {\n    var c struct{ MinRingSize uint64 `json:\"minRingSize\"` }\n    _ = json.Unmarshal(raw, &c)\n    if c.MinRingSize > ringHashUpperBound {\n        return fmt.Errorf(\"minRingSize %d > %d\", c.MinRingSize, ringHashUpperBound)\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat ring sizes as entry counts (small thousands), not bytes.","Prefer defaults (1024/4096) unless you have measured distribution needs.","Add a config lint that rejects ring sizes above 8M."],"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"}