# rpc 错误：code = Unimplemented desc = 未知服务 pb.OrderService

- **ID:** `go/grpc-unimplemented-unknown-method`
- **领域:** go
- **类别:** module_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

客户端调用的完全限定服务名未在服务器上注册。通常由客户端与服务器之间 proto 包名/名称不匹配、生成的桩代码过期，或以不同的包路径注册服务导致。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 1.x | active | — | — |

## 解决方案

1. **** (88% 成功率)
   ```
   Confirm the registered service name on the server matches the client stub by inspecting the descriptor:

sd := pb.File_order_proto.Services().ByName("OrderService")
log.Println("service full name:", sd.FullName())
// ensure pb.RegisterOrderServiceServer(srv, impl) is called
   ```
2. **** (90% 成功率)
   ```
   Regenerate stubs from the canonical .proto and share the exact module version between client and server:

// go.mod on both sides must reference the same generated module version
// buf generate / protoc --go_out=. --go-grpc_out=. order.proto
   ```

## 无效尝试

- **** — The server will never suddenly gain the method; retrying an unimplemented RPC always returns Unimplemented again. (97% 失败率)
- **** — The service name mismatch is independent of the network endpoint; a different port with the same stale stub fails identically. (85% 失败率)
