micro/go-micro · error
rpc: service/endpoint request ill-formed: ${endpoint}
Error message
rpc: service/endpoint request ill-formed: ${endpoint} What it means
This error means the RPC request's Endpoint field did not contain exactly one dot separating service name from method name. The router splits req.msg.Endpoint on '.' and requires exactly two parts; anything else is ill-formed and cannot be routed. The connection is kept alive (keepReading=true) so the client can send further requests.
Source
Thrown at server/rpc_router.go:426
err = cc.ReadHeader(msg, msg.Type)
if err != nil {
req = nil
if err == io.EOF || err == io.ErrUnexpectedEOF {
return
}
err = errors.New("rpc: router cannot decode request: " + err.Error())
return
}
// 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])
}
View on GitHub (pinned to 24529f1404)
Solutions
- Send the endpoint as exactly "ServiceName.MethodName" with a single dot
- Trim any package path or namespace prefix from the service name before sending
- Log req.msg.Endpoint on the client before dispatch to confirm the wire format
- If using a custom codec, ensure it does not mangle or split the endpoint field
Example fix
// before msg.Endpoint = "mypackage/MyService.Calculate" // after msg.Endpoint = "MyService.Calculate"
Defensive patterns
Strategy: validation
Validate before calling
func validEndpoint(ep string) bool {
parts := strings.Split(ep, ".")
return len(parts) == 2 && parts[0] != "" && parts[1] != ""
}
if !validEndpoint(msg.Endpoint) { return fmt.Errorf("bad endpoint: %q", msg.Endpoint) } Prevention
- Always build endpoints from constants: serviceName + "." + methodName
- Never embed package paths, slashes, or version suffixes in the endpoint
- Add a client-side assertion on endpoint format before dispatch
When it happens
Trigger: Sending a request whose endpoint string has no dot ("MyService"), more than one dot ("pkg/MyService.Method" or "Service.Method.Extra"), or an empty endpoint.
Common situations: Hand-rolled RPC clients that forget the Service.Method format; endpoints copied from code paths containing package qualifiers or slashes; a client library upgrade that changed endpoint encoding; empty endpoint due to unset config field.
Related errors
- go.micro.client
- streamer not implemented
- connection header set to close
- rpc Register: type ${sname} is not exported
- rpc: service already defined: ${sname}
AI-assisted analysis of micro/go-micro@24529f1404 (2026-09-01).
Data as JSON: /api/errors/c4f75a780dcd85e8.
Report an issue: GitHub.