go
data_error
ai_generated
true
rpc error: code = OutOfRange desc = index out of bounds: 10 > 5
ID: go/grpc-out-of-range-index
80%Fix Rate
85%Confidence
0Evidence
2025-01-10First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 1.56.x | active | — | — | — |
| 1.57.x | active | — | — | — |
Root Cause
A request attempted to access an element beyond the valid range, e.g., pagination offset too high.
generic中文
请求尝试访问超出有效范围的元素,例如,分页偏移量过高。
Workarounds
-
95% success
if offset > totalItems { offset = totalItems } -
90% success
req := &pb.ListRequest{Offset: offset, Limit: limit}; if offset+limit > max { return error } -
85% success
resp, err := client.List(ctx, req); if resp.TotalCount > 0 { offset = min(offset, resp.TotalCount-1) }
Dead Ends
Common approaches that don't work:
-
Retrying with the same out-of-range index.
100% fail
Same error will occur.
-
Trying negative values.
80% fail
Still out of range.
-
Blaming server for incorrect range validation.
50% fail
Client should respect limits.