micro/go-micro · error

no service node configured

Error message

no service node configured

What it means

RegistryServiceCheck requires a non-empty nodeID so the health probe can target the exact node registration (default: service.Options().Name + "-" + service.Options().Id). An empty nodeID cannot identify a node, so the check fails fast.

Source

Thrown at health/health.go:359

// 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
					}
				}
			}
			errc <- fmt.Errorf("registry %s missing node %s for service %s", reg.String(), nodeID, serviceName)

View on GitHub (pinned to 24529f1404)

Solutions

  1. Pass the node ID used at registration, e.g. service.Options().Name + "-" + service.Options().Id.
  2. Ensure service Options().Id is set (hostname, UUID, or injected instance ID) at startup.
  3. Store/reuse the ID returned by the registration call instead of reconstructing it ad hoc.

Example fix

// before
check := health.RegistryServiceCheck(reg, name, "")

// after
nodeID := name + "-" + svc.Options().Id
check := health.RegistryServiceCheck(reg, name, nodeID)
Defensive patterns

Strategy: validation

Validate before calling

nodeID := svc.Options().Name + "-" + svc.Options().Id
if nodeID == "-" || svc.Options().Id == "" {
	return errors.New("service Options().Id must be set before building registry health check")
}
check := health.RegistryServiceCheck(reg, svc.Options().Name, nodeID)

Try / catch

if err := check(ctx); err != nil {
	if err.Error() == "no service node configured" {
		log.Error("health check misconfigured: nodeID is empty")
	}
}

Prevention

When it happens

Trigger: Calling health.RegistryServiceCheck(reg, serviceName, "") with an empty nodeID argument.

Common situations: Node ID not populated because Options().Id was never set; hand-computed node IDs that don't match the default Name-Id convention; environment where the instance identifier is injected late in startup.

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


AI-assisted analysis of micro/go-micro@24529f1404 (2026-09-01). Data as JSON: /api/errors/f666a0f905a39bad. Report an issue: GitHub.