go config_error ai_generated true

rpc error: code = Unimplemented desc = 从服务端收到意外的 HTTP 状态码:404(未找到);传输:收到意外的 content-type "text/plain"

rpc error: code = Unimplemented desc = unexpected HTTP status code received from server: 404 (Not Found); transport: received unexpected content-type "text/plain"

ID: go/grpc-code-unimplemented-proto-drift

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

版本兼容性

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

根因分析

客户端到达了一个非 gRPC 的 HTTP 服务端(例如普通 HTTP 反向代理、配置错误的 Ingress,或未配置 gRPC 的 Envoy 路由)。服务端返回了 text/plain 的 404,而非 gRPC 帧。

English

The client reached an HTTP server that is not a gRPC server (e.g., a plain HTTP reverse proxy, a misconfigured ingress, or an Envoy route not configured for gRPC). The server returned a text/plain 404 instead of gRPC frames.

generic

解决方案

  1. 90% 成功率
    // Kubernetes ingress-nginx:
    // annotations:
    //   nginx.ingress.kubernetes.io/backend-protocol: "GRPC"
    //   nginx.ingress.kubernetes.io/ssl-redirect: "true"
  2. 92% 成功率
    // Use the gRPC service port (often 50051) rather than 8080/9090
    conn, _ := grpc.Dial("svc:50051", grpc.WithTransportCredentials(insecure.NewCredentials()))

无效尝试

常见但无效的做法:

  1. 95% 失败

    The routing is misconfigured; retries always hit the same HTTP endpoint

  2. 90% 失败

    The problem is HTTP/gRPC protocol mismatch, not TLS