{"record":{"id":"f666a0f905a39bad","repo":"micro/go-micro","slug":"no-service-node-configured","errorCode":null,"errorMessage":"no service node configured","messagePattern":"no service node configured","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"health/health.go","lineNumber":359,"sourceCode":"// RegistryServiceCheck creates a check that verifies the local service\n// registration is visible in the registry. RegistryCheck only proves the\n// registry is reachable; this check also catches the common failure mode\n// where the process is alive and the registry answers, but this service's\n// node lease/record has disappeared and other services can no longer\n// discover it.\n//\n// Pass the service name and node ID used during registration. The default\n// RPC server node ID is service.Options().Name + \"-\" + service.Options().Id.\nfunc RegistryServiceCheck(reg registry.Registry, serviceName, nodeID string) CheckFunc {\n\treturn func(ctx context.Context) error {\n\t\tif reg == nil {\n\t\t\treturn errors.New(\"no registry configured\")\n\t\t}\n\t\tif serviceName == \"\" {\n\t\t\treturn errors.New(\"no service name configured\")\n\t\t}\n\t\tif nodeID == \"\" {\n\t\t\treturn errors.New(\"no service node configured\")\n\t\t}\n\n\t\terrc := make(chan error, 1)\n\t\tgo func() {\n\t\t\tservices, err := reg.GetService(serviceName, registry.GetContext(ctx))\n\t\t\tif err != nil {\n\t\t\t\terrc <- fmt.Errorf(\"registry %s lookup %s failed: %w\", reg.String(), serviceName, err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tfor _, service := range services {\n\t\t\t\tfor _, node := range service.Nodes {\n\t\t\t\t\tif node.Id == nodeID {\n\t\t\t\t\t\terrc <- nil\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\terrc <- fmt.Errorf(\"registry %s missing node %s for service %s\", reg.String(), nodeID, serviceName)","sourceCodeStart":341,"sourceCodeEnd":377,"githubUrl":"https://github.com/micro/go-micro/blob/24529f140421a11a33b6999ab7944f2021cfd69c/health/health.go#L341-L377","documentation":"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.","triggerScenarios":"Calling health.RegistryServiceCheck(reg, serviceName, \"\") with an empty nodeID argument.","commonSituations":"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.","solutions":["Pass the node ID used at registration, e.g. service.Options().Name + \"-\" + service.Options().Id.","Ensure service Options().Id is set (hostname, UUID, or injected instance ID) at startup.","Store/reuse the ID returned by the registration call instead of reconstructing it ad hoc."],"exampleFix":"// before\ncheck := health.RegistryServiceCheck(reg, name, \"\")\n\n// after\nnodeID := name + \"-\" + svc.Options().Id\ncheck := health.RegistryServiceCheck(reg, name, nodeID)","handlingStrategy":"validation","validationCode":"nodeID := svc.Options().Name + \"-\" + svc.Options().Id\nif nodeID == \"-\" || svc.Options().Id == \"\" {\n\treturn errors.New(\"service Options().Id must be set before building registry health check\")\n}\ncheck := health.RegistryServiceCheck(reg, svc.Options().Name, nodeID)","typeGuard":null,"tryCatchPattern":"if err := check(ctx); err != nil {\n\tif err.Error() == \"no service node configured\" {\n\t\tlog.Error(\"health check misconfigured: nodeID is empty\")\n\t}\n}","preventionTips":["Always set Options().Id at startup (hostname or UUID) before registration.","Reuse the registration-returned node ID rather than recomputing it.","Follow the default Name-Id convention consistently across services."],"tags":["health","registry","validation","node-id"],"backgroundTag":"missing-required-argument","analyzedSha":"24529f140421a11a33b6999ab7944f2021cfd69c","analyzedAt":"2026-09-01T02:52:24.923Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}