{"record":{"id":"9fd0267e7f053052","repo":"hashicorp/nomad","slug":"http-addr-of-node-q-s-is-not-advertised","errorCode":null,"errorMessage":"http addr of node %q (%s) is not advertised","messagePattern":"http addr of node %q \\((.+?)\\) is not advertised","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"api/api.go","lineNumber":606,"sourceCode":"}\n\n// nodeLookup is the definition of a function used to lookup a node. This is\n// largely used to mock the lookup in tests.\ntype nodeLookup func(nodeID string, q *QueryOptions) (*Node, *QueryMeta, error)\n\n// getNodeClientImpl is the implementation of creating a API client for\n// contacting a node. It takes a function to lookup the node such that it can be\n// mocked during tests.\nfunc (c *Client) getNodeClientImpl(nodeID string, timeout time.Duration, q *QueryOptions, lookup nodeLookup) (*Client, error) {\n\tnode, _, err := lookup(nodeID, q)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif node.Status == \"down\" {\n\t\treturn nil, NodeDownErr\n\t}\n\tif node.HTTPAddr == \"\" {\n\t\treturn nil, fmt.Errorf(\"http addr of node %q (%s) is not advertised\", node.Name, nodeID)\n\t}\n\n\tvar region string\n\tswitch {\n\tcase q != nil && q.Region != \"\":\n\t\t// Prefer the region set in the query parameter\n\t\tregion = q.Region\n\tcase c.config.Region != \"\":\n\t\t// If the client is configured for a particular region use that\n\t\tregion = c.config.Region\n\tdefault:\n\t\t// No region information is given so use GlobalRegion as the default.\n\t\tregion = GlobalRegion\n\t}\n\n\t// Get an API client for the node\n\tconf := c.config.ClientConfig(region, node.HTTPAddr, node.TLSEnabled)\n","sourceCodeStart":588,"sourceCodeEnd":624,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/api/api.go#L588-L624","documentation":"In api/api.go:606, getNodeClientImpl fetches the node to find its advertised HTTPAddr and returns this error when node.HTTPAddr is empty — the Nomad client agent has not advertised an HTTP address, so there is no known endpoint to talk to directly on that node. NodeDownErr-style precondition check before building a node-scoped client.","triggerScenarios":"Calling GetNodeClient/GetNodeClientWithTimeout(nodeID) for a node whose status is not \"down\" but whose HTTPAddr is empty — typically an incomplete registration or a node agent that never advertised its API address.","commonSituations":"Node recently joined and registration not complete; client agent configured with no bind address advertised (broken advertise settings); stale node entries after agent reinstall; querying a node in a partitioned/lossy cluster.","solutions":["Verify the Nomad client agent is running and healthy on that node (nomad node status <id>)","Wait for/retry after node registration completes on fresh joins","Check client advertise configuration (client { ... }) so the agent advertises its HTTP address","Force a re-registration (restart the nomad agent on the client) if the node entry is stale","Fall back to server-routed APIs (e.g. via the server's proxy endpoints) if you cannot reach the node directly"],"exampleFix":"// before\nnodeClient, err := client.GetNodeClient(nodeID) // fails on half-registered node\n// after\nnode, _, _ := client.Nodes().Info(nodeID, nil)\nif node.HTTPAddr == \"\" { return nil, fmt.Errorf(\"node %s not ready; retry after registration\", nodeID) }\nnodeClient, err := client.GetNodeClient(nodeID)","handlingStrategy":"retry","validationCode":"node, _, err := client.Nodes().Info(nodeID, nil)\nif err != nil { return err }\nif node.Status == \"down\" { return api.NodeDownErr }\nif node.HTTPAddr == \"\" { return errors.New(\"node not fully registered yet; retry\") }","typeGuard":"func nodeReachable(n *api.Node) bool {\n\treturn n != nil && n.Status != \"down\" && n.HTTPAddr != \"\"\n}","tryCatchPattern":"nodeClient, err := client.GetNodeClient(nodeID)\nif err != nil && strings.Contains(err.Error(), \"is not advertised\") {\n\treturn retryWithBackoff(5*time.Second, 6, func() error { _, e := client.GetNodeClient(nodeID); return e })\n}","preventionTips":["Check nomad node status before node-scoped API calls","Handle freshly joined nodes with a short retry window","Ensure client agents advertise HTTP addresses (default config)","Have a server-routed fallback for APIs when direct node access is impossible"],"tags":["nomad","node","network","nomad-api"],"backgroundTag":"http-addr-not-advertised","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"}