{"record":{"id":"08e8d5b1687123ae","repo":"micro/go-micro","slug":"rpc-can-t-find-service-service","errorCode":null,"errorMessage":"rpc: can't find service ${service}","messagePattern":"rpc: can't find service (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/rpc_router.go","lineNumber":436,"sourceCode":"\t}\n\n\t// We read the header successfully. If we see an error now,\n\t// we can still recover and move on to the next request.\n\tkeepReading = true\n\n\tserviceMethod := strings.Split(req.msg.Endpoint, \".\")\n\tif len(serviceMethod) != 2 {\n\t\terr = errors.New(\"rpc: service/endpoint request ill-formed: \" + req.msg.Endpoint)\n\t\treturn\n\t}\n\n\t// Look up the request.\n\trouter.mu.Lock()\n\tservice = router.serviceMap[serviceMethod[0]]\n\trouter.mu.Unlock()\n\n\tif service == nil {\n\t\terr = errors.New(\"rpc: can't find service \" + serviceMethod[0])\n\t\treturn\n\t}\n\n\tmtype = service.method[serviceMethod[1]]\n\tif mtype == nil {\n\t\terr = errors.New(\"rpc: can't find method \" + serviceMethod[1])\n\t}\n\n\treturn\n}\n\nfunc (router *router) NewHandler(h interface{}, opts ...HandlerOption) Handler {\n\treturn NewRpcHandler(h, opts...)\n}\n\nfunc (router *router) Handle(h Handler) error {\n\trouter.mu.Lock()\n\tdefer router.mu.Unlock()","sourceCodeStart":418,"sourceCodeEnd":454,"githubUrl":"https://github.com/micro/go-micro/blob/24529f140421a11a33b6999ab7944f2021cfd69c/server/rpc_router.go#L418-L454","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","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"],"exampleFix":"// before (client)\nmsg.Endpoint = \"OrderSvc.Place\" // never registered\n// after (server)\nrouter.NewHandler(NewOrderService(\"OrderSvc\"))\n// client\nmsg.Endpoint = \"OrderSvc.Place\"","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"reply, err := client.Call(ctx, \"OrderSvc.Place\", args)\nif err != nil {\n\tif strings.Contains(err.Error(), \"can't find service\") {\n\t\t// fail fast: wrong server or service not registered; do not retry blindly\n\t\tlog.Fatalf(\"service not registered: %v\", err)\n\t}\n\treturn err\n}","preventionTips":["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"],"tags":["rpc","routing","service-lookup"],"backgroundTag":"rpc-service-not-found","analyzedSha":"24529f140421a11a33b6999ab7944f2021cfd69c","analyzedAt":"2026-09-01T02:52:24.923Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}