micro/go-micro · error
rpc: can't find method ${method}
Error message
rpc: can't find method ${method} What it means
The service was found in the router's serviceMap, but the method name (the part after the dot) has no matching registered method entry in service.method. The method either does not exist on the handler type or was not eligible for RPC registration.
Source
Thrown at server/rpc_router.go:442
serviceMethod := strings.Split(req.msg.Endpoint, ".")
if len(serviceMethod) != 2 {
err = errors.New("rpc: service/endpoint request ill-formed: " + req.msg.Endpoint)
return
}
// Look up the request.
router.mu.Lock()
service = router.serviceMap[serviceMethod[0]]
router.mu.Unlock()
if service == nil {
err = errors.New("rpc: can't find service " + serviceMethod[0])
return
}
mtype = service.method[serviceMethod[1]]
if mtype == nil {
err = errors.New("rpc: can't find method " + serviceMethod[1])
}
return
}
func (router *router) NewHandler(h interface{}, opts ...HandlerOption) Handler {
return NewRpcHandler(h, opts...)
}
func (router *router) Handle(h Handler) error {
router.mu.Lock()
defer router.mu.Unlock()
if router.serviceMap == nil {
router.serviceMap = make(map[string]*service)
}
if len(h.Name()) == 0 {View on GitHub (pinned to 24529f1404)
Solutions
- Check the endpoint's method name matches an exported method on the handler exactly
- Ensure the method satisfies the library's RPC method signature requirements so it gets registered
- Align client and server versions so the called method exists on the server
- Log available methods for the service at registration time to debug mismatches
Example fix
// before
msg.Endpoint = "Calculator.multiply" // unexported, never registered
// after
type Calculator struct{}
func (c *Calculator) Multiply(args *Args, reply *int) error { ... }
msg.Endpoint = "Calculator.Multiply" Defensive patterns
Strategy: try-catch
Try / catch
err := client.Call(ctx, "Calculator.Multiply", args, &reply)
if err != nil {
if strings.Contains(err.Error(), "can't find method") {
// wrong method name or server version skew; surface to caller
return fmt.Errorf("method unavailable: %w", err)
}
return err
} Prevention
- Keep client and server on compatible versions; bump both when renaming methods
- Only call exported methods matching the RPC signature conventions
- Generate client stubs from the server's registered methods instead of hand-writing names
When it happens
Trigger: Calling Service.Method where Method is not an exported method of the registered handler, has a signature that failed method registration, or is simply misspelled in the endpoint.
Common situations: Method renamed or removed in a newer server version while clients call the old name; method unexported (lowercase) and therefore never registered; method signature not matching the RPC conventions so it was skipped during Handle; typo in method name.
Related errors
- rpc: can't find service ${service}
- go.micro.client
- streamer not implemented
- connection header set to close
- rpc Register: type ${sname} is not exported
AI-assisted analysis of micro/go-micro@24529f1404 (2026-09-01).
Data as JSON: /api/errors/a4b81d404efd7799.
Report an issue: GitHub.