# 未实现：gRPC：服务器中未实现服务：mypackage.MyService

- **ID:** `grpc/grpc-unimplemented-service`
- **领域:** grpc
- **类别:** config_error
- **错误码:** `ESVC`
- **验证级别:** ai_generated
- **修复率:** 85%

## 根因

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

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| gRPC v1.61.0 | active | — | — |
| gRPC v1.58.0 | active | — | — |
| gRPC v1.54.0 | active | — | — |
| Node.js gRPC v1.24.0 | active | — | — |

## 解决方案

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

## 无效尝试

- **Restarting the server without recompiling the service** — The service registration is missing in the code; restart doesn't add it. (95% 失败率)
- **Adding the service proto file to the client only** — The server must implement the service; client-side proto doesn't help. (90% 失败率)
