go data_error ai_generated true

rpc error: code = InvalidArgument desc = invalid enum value: 99 for field status

ID: go/grpc-out-of-range-enum-value

Also available as: JSON · Markdown · 中文
80%Fix Rate
87%Confidence
0Evidence
2024-03-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
1.0 active — — —

Root Cause

The client sends an integer that doesn't map to any defined enum value in the proto.

generic

中文

客户端发送的整数未映射到 proto 中定义的任何枚举值。

Workarounds

  1. 95% success
    if status < pb.Status_STATUS_UNKNOWN || status > pb.Status_STATUS_DONE { return error }
  2. 80% success
    // Use protoreflect to check if value is defined.

Dead Ends

Common approaches that don't work:

  1. 80% fail

    Go will allow the conversion but protobuf deserialization will fail.

  2. 100% fail

    The server will reject the message.