{"record":{"id":"aedebae61f7494f8","repo":"hashicorp/nomad","slug":"advertiseaddrs-is-nil-or-empty","errorCode":null,"errorMessage":"AdvertiseAddrs is nil or empty","messagePattern":"AdvertiseAddrs is nil or empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"command/agent/agent.go","lineNumber":810,"sourceCode":"\treturn c, nil\n}\n\n// finalizeClientConfig sets configuration fields on the client config that are\n// not statically convertible and are from the agent.\nfunc (a *Agent) finalizeClientConfig(c *clientconfig.Config) error {\n\t// Setup the logging\n\tc.Logger = a.logger\n\n\t// If we are running a server, append both its bind and advertise address so\n\t// we are able to at least talk to the local server even if that isn't\n\t// configured explicitly. This handles both running server and client on one\n\t// host and -dev mode.\n\tif a.server != nil {\n\t\tadvertised := a.config.AdvertiseAddrs\n\t\tnormalized := a.config.normalizedAddrs\n\n\t\tif advertised == nil || advertised.RPC == \"\" {\n\t\t\treturn fmt.Errorf(\"AdvertiseAddrs is nil or empty\")\n\t\t} else if normalized == nil || normalized.RPC == \"\" {\n\t\t\treturn fmt.Errorf(\"normalizedAddrs is nil or empty\")\n\t\t}\n\n\t\tif normalized.RPC == advertised.RPC {\n\t\t\tc.Servers = append(c.Servers, normalized.RPC)\n\t\t} else {\n\t\t\tc.Servers = append(c.Servers, normalized.RPC, advertised.RPC)\n\t\t}\n\t}\n\n\t// Setup the plugin loaders\n\tc.PluginLoader = a.pluginLoader\n\tc.PluginSingletonLoader = a.pluginSingletonLoader\n\n\t// Log deprecation messages about Consul related configuration in client\n\t// options\n\tvar invalidConsulKeys []string","sourceCodeStart":792,"sourceCodeEnd":828,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/command/agent/agent.go#L792-L828","documentation":"finalizeClientConfig builds the agent's internal client config when a server is also running (a.server != nil). It appends the advertised RPC address to the client's server list, so AdvertiseAddrs (and its RPC field) must be set. If a.config.AdvertiseAddrs is nil or AdvertiseAddrs.RPC is empty, Nomad cannot tell the client where to reach the co-located server and returns this error.","triggerScenarios":"Running the Nomad agent in combined server+client mode (server{enabled=true} client{enabled=true}) where AdvertiseAddrs was never populated, or AdvertiseAddrs.RPC is empty, by the time finalizeClientConfig runs during startup or reload.","commonSituations":"Config files that set bind_addr but omit advertise settings in environments where normalization failed; custom agent setups constructed programmatically without AdvertiseAddrs; partial config merges dropping the advertise block.","solutions":["Set advertise { rpc = \"host:4647\" } or set bind_addr so Nomad can derive an RPC advertise address.","Ensure advertising is configured before client startup (advertise { http/rpc/serf }).","Check for config normalization failures earlier in the log that left AdvertiseAddrs unset."],"exampleFix":"// before (hcl)\nserver { enabled = true }\nclient { enabled = true }\n// after\nbind_addr = \"192.168.1.10\"\nadvertise { rpc = \"192.168.1.10:4647\" }\nserver { enabled = true }\nclient { enabled = true }","handlingStrategy":"validation","validationCode":"if cfg.AdvertiseAddrs == nil || cfg.AdvertiseAddrs.RPC == \"\" {\n  return errors.New(\"advertise { rpc } must be set when running server+client on one agent\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set bind_addr and advertise blocks in combined server+client configs.","Smoke-test agent startup in staging where normalization runs.","Watch early startup logs for address-normalization warnings."],"tags":["config","nomad","advertise","network"],"backgroundTag":"advertise-addr-missing","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"}