micro/go-micro · error
rpc: can't find service ${service}
Error message
rpc: can't find service ${service} What it means
The endpoint was well-formed, but the service name (the part before the dot) is not present in the router's serviceMap. No handler with that name was registered via Handle/NewHandler on this server. The request is rejected and the server continues reading.
Source
Thrown at server/rpc_router.go:436
}
// We read the header successfully. If we see an error now,
// we can still recover and move on to the next request.
keepReading = true
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()View on GitHub (pinned to 24529f1404)
Solutions
- Register the service on the server before accepting requests: server.Handle(handler)
- Verify the endpoint's service name matches h.Name() exactly, including case
- Confirm the client is dialing the server instance that actually registers this service
- List registered services at startup and log them to compare with client requests
Example fix
// before (client)
msg.Endpoint = "OrderSvc.Place" // never registered
// after (server)
router.NewHandler(NewOrderService("OrderSvc"))
// client
msg.Endpoint = "OrderSvc.Place" Defensive patterns
Strategy: try-catch
Try / catch
reply, err := client.Call(ctx, "OrderSvc.Place", args)
if err != nil {
if strings.Contains(err.Error(), "can't find service") {
// fail fast: wrong server or service not registered; do not retry blindly
log.Fatalf("service not registered: %v", err)
}
return err
} Prevention
- Register all services before the server starts accepting connections
- Share a single source of truth (constants) for service names between client and server
- Log the set of registered service names at server startup
- Verify client dial target points at the server hosting the service
When it happens
Trigger: Calling an RPC whose service name was never registered, registered under a different name, or registered on a different router/server instance; typo in the service portion of the endpoint.
Common situations: Service renamed during refactoring while clients still use the old name; handler registration skipped due to failed startup ordering; client pointed at the wrong server/port that hosts other services; case mismatch (service names must be exported).
Related errors
- rpc: can't find method ${method}
- 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/08e8d5b1687123ae.
Report an issue: GitHub.