# rpc错误：代码=未实现 描述=未知服务helloworld.Greeter

- **ID:** `go/grpc-unimplemented-service-not-registered`
- **领域:** go
- **类别:** type_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

gRPC服务器未注册该服务，通常是因为服务器代码未调用RegisterGreeterServer。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 1.0 | active | — | — |
| 1.1 | active | — | — |

## 解决方案

1. **Register the service with the gRPC server.** (95% 成功率)
   ```
   grpcServer := grpc.NewServer()
pb.RegisterGreeterServer(grpcServer, &server{})
// Then start listening
lis, _ := net.Listen("tcp", ":8080")
grpcServer.Serve(lis)
   ```
2. **Ensure the protobuf generated code is imported and used correctly.** (90% 成功率)
   ```
   import pb "path/to/protobuf/package"
// Then use pb.RegisterGreeterServer
   ```

## 无效尝试

- **Restart the server without registering the service.** — The server code is missing the registration; restarting doesn't add it. (100% 失败率)
- **Use a different client that expects a different service.** — The client is hardcoded to call a specific service; changing client may not help. (90% 失败率)
