micro/go-micro · error
no service name configured
Error message
no service name configured
What it means
RegistryServiceCheck requires a non-empty serviceName because it queries the registry with GetService(serviceName). An empty name cannot identify a service, so the check returns this error immediately before touching the registry.
Source
Thrown at health/health.go:356
}
}
// RegistryServiceCheck creates a check that verifies the local service
// registration is visible in the registry. RegistryCheck only proves the
// registry is reachable; this check also catches the common failure mode
// where the process is alive and the registry answers, but this service's
// node lease/record has disappeared and other services can no longer
// discover it.
//
// Pass the service name and node ID used during registration. The default
// RPC server node ID is service.Options().Name + "-" + service.Options().Id.
func RegistryServiceCheck(reg registry.Registry, serviceName, nodeID string) CheckFunc {
return func(ctx context.Context) error {
if reg == nil {
return errors.New("no registry configured")
}
if serviceName == "" {
return errors.New("no service name configured")
}
if nodeID == "" {
return errors.New("no service node configured")
}
errc := make(chan error, 1)
go func() {
services, err := reg.GetService(serviceName, registry.GetContext(ctx))
if err != nil {
errc <- fmt.Errorf("registry %s lookup %s failed: %w", reg.String(), serviceName, err)
return
}
for _, service := range services {
for _, node := range service.Nodes {
if node.Id == nodeID {
errc <- nil
return
}View on GitHub (pinned to 24529f1404)
Solutions
- Pass the correct service name — typically service.Options().Name — to RegistryServiceCheck.
- Validate the config value feeding serviceName at startup and fail fast if empty.
- Default to the process's known service name instead of an empty string.
Example fix
// before
check := health.RegistryServiceCheck(reg, cfg.ServiceName, nodeID) // cfg.ServiceName == ""
// after
name := cfg.ServiceName
if name == "" {
name = svc.Options().Name
}
check := health.RegistryServiceCheck(reg, name, nodeID) Defensive patterns
Strategy: validation
Validate before calling
if serviceName == "" {
serviceName = svc.Options().Name
}
check := health.RegistryServiceCheck(reg, serviceName, nodeID) Try / catch
if err := check(ctx); err != nil {
if err.Error() == "no service name configured" {
log.Error("health check misconfigured: serviceName is empty")
}
} Prevention
- Read serviceName from service.Options().Name, never from raw config that may be unset.
- Fail fast at boot when required identity config keys are empty.
- Unit-test health wiring with realistic populated options.
When it happens
Trigger: Calling health.RegistryServiceCheck(reg, "", nodeID) with an empty serviceName argument, then executing the check.
Common situations: Service name read from an unset config key or empty environment variable; call sites that pass options.Name before options are fully initialized; refactors that changed how the name is derived.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- no registry configured
- no service node configured
- ai model is nil
- require at least one node
- require at least one node
AI-assisted analysis of micro/go-micro@24529f1404 (2026-09-01).
Data as JSON: /api/errors/2ec4d6ca847bba85.
Report an issue: GitHub.