{"record":{"id":"43c7a11fcda73fdf","repo":"hashicorp/nomad","slug":"no-nomad-servers-advertising-service-q-in-consul","errorCode":null,"errorMessage":"no Nomad Servers advertising service %q in Consul datacenters: %+q","messagePattern":"no Nomad Servers advertising service %q in Consul datacenters: %\\+q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"client/client.go","lineNumber":3186,"sourceCode":"\t\t\tif err != nil {\n\t\t\t\tmErr.Errors = append(mErr.Errors, err)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tsrv := &servers.Server{Addr: addr}\n\t\t\tnomadServers = append(nomadServers, srv)\n\t\t}\n\n\t\tif len(nomadServers) > 0 {\n\t\t\tbreak DISCOLOOP\n\t\t}\n\n\t}\n\tif len(nomadServers) == 0 {\n\t\tif len(mErr.Errors) > 0 {\n\t\t\treturn mErr.ErrorOrNil()\n\t\t}\n\t\treturn fmt.Errorf(\"no Nomad Servers advertising service %q in Consul datacenters: %+q\", serviceName, dcs)\n\t}\n\n\tconsulLogger.Info(\"discovered following servers\", \"servers\", nomadServers)\n\n\t// Fire the retry trigger if we have updated the set of servers.\n\tif c.servers.SetServers(nomadServers) {\n\t\t// Start rebalancing\n\t\tc.servers.RebalanceServers()\n\n\t\t// Notify waiting rpc calls. If a goroutine just failed an RPC call and\n\t\t// isn't receiving on this chan yet they'll still retry eventually.\n\t\t// This is a shortcircuit for the longer retry intervals.\n\t\tc.fireRpcRetryWatcher()\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":3168,"sourceCodeEnd":3204,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/client.go#L3168-L3204","documentation":"After querying all Consul datacenters for the `nomad` RPC service, `consulDiscoveryImpl` throws \"no Nomad Servers advertising service %q in Consul datacenters: %+q\" when zero servers were found. If individual DC queries errored, the aggregated multi-error is returned instead. This means Consul knows the datacenters but no healthy Nomad server instances are registered under the service name.","triggerScenarios":"All Nomad servers down or deregistered from Consul; servers registered under a different service name than the client's discovery config; health checks failing so Consul marks all instances unavailable.","commonSituations":"Server outage or rolling restart draining all registrations; mismatch between server `consul.service[0].name` and client discovery service name; Consul health checks failing due to firewall blocking the server RPC port (4647).","solutions":["Check that Nomad servers are running and registered in Consul (`consul catalog services` / health of the nomad service)","Ensure server and client consul service-name configs match","Fix failing Consul health checks (verify server RPC port 4647 is reachable from Consul)","Retry after servers re-register; discovery is retried on the client's retry loop"],"exampleFix":"// nomad server config\n// before\nconsul { service {\n  name = \"nomad-server\"  // clients look for \"nomad\"\n} }\n// after\nconsul { service {\n  name = \"nomad\"\n} }","handlingStrategy":"fallback","validationCode":"entries, _, err := consul.Health().Service(\"nomad\", \"\", true, nil)\nif err != nil || len(entries) == 0 {\n    log.Println(\"no healthy nomad servers registered in Consul\")\n}","typeGuard":null,"tryCatchPattern":"err := client.consulDiscoveryImpl()\nif err != nil {\n    if strings.Contains(err.Error(), \"no Nomad Servers advertising\") {\n        // fall back to static server list or wait for servers to re-register\n        useStaticServerList()\n    }\n}","preventionTips":["Keep at least one healthy Nomad server registered with passing Consul health checks","Match server and client consul service name configuration","Ensure server RPC port (4647) is reachable so health checks pass","Configure a static server fallback in client config for resilience"],"tags":["nomad","consul","service-discovery","no-servers"],"backgroundTag":"no-servers-discovered","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}