go data_error ai_generated true

rpc 错误:代码 = Unknown 描述 = 状态格式错误:无状态详情

rpc error: code = Unknown desc = malformed status: no status details

ID: go/grpc-status-details-missing

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

版本兼容性

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

根因分析

服务器返回的状态没有详情,但客户端期望 google.rpc.Status 详情,导致 proto 反序列化失败。

English

Server returns a status with no details, but client expects google.rpc.Status details, causing proto unmarshal failure.

generic

解决方案

  1. 90% 成功率
    if s, ok := status.FromError(err); ok { for _, d := range s.Details() { /* handle */ } }
  2. 80% 成功率
    st := status.New(codes.Unknown, "error"); st, _ = st.WithDetails(&errdetails.ErrorInfo{}); return st.Err()

无效尝试

常见但无效的做法:

  1. 70% 失败

    Server logs show no error because the status is intentionally empty; issue is in client-side parsing.

  2. 90% 失败

    Credentials are not the issue; the problem is in the status detail parsing logic.