micro/go-micro · error

no registry configured

Error message

no registry configured

What it means

RegistryCheck returns a CheckFunc used by the health framework to probe a service registry. If the Registry argument is nil, the check immediately fails with this error so the health report shows the registry as down instead of panicking on a nil-pointer call to ListServices.

Source

Thrown at health/health.go:322

	}
}

// RegistryCheck creates a check that verifies the service registry is
// reachable by listing services. Registered checks are critical by
// default, so a service is reported not-ready when it loses its
// connection to the registry — wire it to a Kubernetes readiness probe
// on /health/ready:
//
//	health.Register("registry", health.RegistryCheck(service.Options().Registry))
//
// The lookup runs under the check's timeout, so an unreachable registry
// (for example an etcd that has gone away) is reported as down rather
// than blocking the probe. Registries that honor ListContext also receive
// the check context directly.
func RegistryCheck(reg registry.Registry) CheckFunc {
	return func(ctx context.Context) error {
		if reg == nil {
			return errors.New("no registry configured")
		}
		errc := make(chan error, 1)
		go func() {
			_, err := reg.ListServices(registry.ListContext(ctx))
			errc <- err
		}()
		select {
		case err := <-errc:
			if err != nil {
				return fmt.Errorf("registry %s unreachable: %w", reg.String(), err)
			}
			return nil
		case <-ctx.Done():
			return fmt.Errorf("registry %s check timed out: %w", reg.String(), ctx.Err())
		}
	}
}

View on GitHub (pinned to 24529f1404)

Solutions

  1. Configure a real registry (etcd, consul, memory) so the service passes a non-nil registry.Registry to RegistryCheck.
  2. Only register the registry health check when a registry is actually configured.
  3. If nil is expected, map this error to a benign/down state in your health aggregation instead of treating it as a crash.

Example fix

// before
checks["registry"] = health.RegistryCheck(nil)

// after
if reg != nil {
	checks["registry"] = health.RegistryCheck(reg)
}
Defensive patterns

Strategy: validation

Validate before calling

if reg == nil {
	// skip registering the health check or configure a registry first
}

Type guard

func hasRegistry(reg registry.Registry) bool {
	return reg != nil
}

Try / catch

if err := check(ctx); err != nil {
	if err.Error() == "no registry configured" {
		report.Status = "down"
		report.Detail = "registry backend not configured"
	}
}

Prevention

When it happens

Trigger: Passing nil as the registry.Registry to health.RegistryCheck, then running the resulting check during a health probe.

Common situations: Optional registry dependencies (e.g. etcd) not configured in the environment; wiring code that always calls RegistryCheck even when no registry plugin is enabled; misconfigured service options leaving the registry unset.

Related errors


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