ESVC grpc config_error ai_generated true

未实现:gRPC:服务器中未实现服务:mypackage.MyService

UNIMPLEMENTED: grpc: service not implemented in server: mypackage.MyService

ID: grpc/grpc-unimplemented-service

其他格式: JSON · Markdown 中文 · English
85%修复率
89%置信度
1证据数
2024-06-18首次发现

版本兼容性

版本状态引入弃用备注
gRPC v1.61.0 active
gRPC v1.58.0 active
gRPC v1.54.0 active
Node.js gRPC v1.24.0 active

根因分析

gRPC 服务器未注册或实现请求的服务,通常是由于缺少存根注册或 proto 不匹配。

English

The gRPC server does not register or implement the requested service, often due to missing stub registration or proto mismatch.

generic

官方文档

https://grpc.io/docs/guides/error-handling/#unimplemented

解决方案

  1. 在服务器上注册服务实现,例如在 Python 中:在添加 `add_MyServiceServicer_to_server(MyServiceServicer(), server)` 后使用 `server.add_insecure_port('[::]:50051'); server.start()`。
  2. 验证客户端和服务器使用完全相同的 proto 文件版本;如果不匹配则重新生成存根。

无效尝试

常见但无效的做法:

  1. Restarting the server without recompiling the service 95% 失败

    The service registration is missing in the code; restart doesn't add it.

  2. Adding the service proto file to the client only 90% 失败

    The server must implement the service; client-side proto doesn't help.