go module_error ai_generated true

rpc error: code = Unimplemented desc = unknown service pb.OrderService

ID: go/grpc-unimplemented-unknown-method

Also available as: JSON · Markdown · 中文
80%Fix Rate
87%Confidence
0Evidence
2024-06-03First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
1.x active — — —

Root Cause

The client is calling a fully-qualified service name that the server does not have registered. Usually caused by mismatched proto package/name between client and server, a stale generated stub, or registering the service under a different package path.

generic

中文

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

Workarounds

  1. 88% success
    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% success
    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

Dead Ends

Common approaches that don't work:

  1. 97% fail

    The server will never suddenly gain the method; retrying an unimplemented RPC always returns Unimplemented again.

  2. 85% fail

    The service name mismatch is independent of the network endpoint; a different port with the same stale stub fails identically.