go data_error ai_generated true

rpc 错误:代码 = Internal 描述 = grpc:响应反序列化错误:proto:无法解析无效的 wire-format 数据

rpc error: code = Internal desc = grpc: error unmarshalling response: proto: cannot parse invalid wire-format data

ID: go/grpc-malformed-response

其他格式: JSON · Markdown 中文 · English
80%修复率
82%置信度
0证据数
2025-01-05首次发现

版本兼容性

版本状态引入弃用备注
1.13 active

根因分析

服务器发送的响应不是有效的 protobuf 消息,可能是由于服务器序列化错误或网络流损坏。

English

The server sent a response that is not a valid protobuf message, possibly due to a bug in the server's serialization or a corrupted network stream.

generic

解决方案

  1. 85% 成功率 Check the server's protobuf version and regenerate code
    protoc --go_out=. --go-grpc_out=. your.proto
  2. 80% 成功率 Enable gRPC max receive message size on the client
    grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(10*1024*1024))

无效尝试

常见但无效的做法:

  1. Ignore the error and retry with the same request 70% 失败

    If the server has a bug, it will likely produce the same malformed response.

  2. Use a different protobuf library 40% 失败

    The wire format is standard; the issue is likely in the server's generation.