hashicorp/nomad · error

AdvertiseAddrs is nil or empty

Error message

AdvertiseAddrs is nil or empty

What it means

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.

Source

Thrown at command/agent/agent.go:810

	return c, nil
}

// finalizeClientConfig sets configuration fields on the client config that are
// not statically convertible and are from the agent.
func (a *Agent) finalizeClientConfig(c *clientconfig.Config) error {
	// Setup the logging
	c.Logger = a.logger

	// If we are running a server, append both its bind and advertise address so
	// we are able to at least talk to the local server even if that isn't
	// configured explicitly. This handles both running server and client on one
	// host and -dev mode.
	if a.server != nil {
		advertised := a.config.AdvertiseAddrs
		normalized := a.config.normalizedAddrs

		if advertised == nil || advertised.RPC == "" {
			return fmt.Errorf("AdvertiseAddrs is nil or empty")
		} else if normalized == nil || normalized.RPC == "" {
			return fmt.Errorf("normalizedAddrs is nil or empty")
		}

		if normalized.RPC == advertised.RPC {
			c.Servers = append(c.Servers, normalized.RPC)
		} else {
			c.Servers = append(c.Servers, normalized.RPC, advertised.RPC)
		}
	}

	// Setup the plugin loaders
	c.PluginLoader = a.pluginLoader
	c.PluginSingletonLoader = a.pluginSingletonLoader

	// Log deprecation messages about Consul related configuration in client
	// options
	var invalidConsulKeys []string

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Set advertise { rpc = "host:4647" } or set bind_addr so Nomad can derive an RPC advertise address.
  2. Ensure advertising is configured before client startup (advertise { http/rpc/serf }).
  3. Check for config normalization failures earlier in the log that left AdvertiseAddrs unset.

Example fix

// before (hcl)
server { enabled = true }
client { enabled = true }
// after
bind_addr = "192.168.1.10"
advertise { rpc = "192.168.1.10:4647" }
server { enabled = true }
client { enabled = true }
Defensive patterns

Strategy: validation

Validate before calling

if cfg.AdvertiseAddrs == nil || cfg.AdvertiseAddrs.RPC == "" {
  return errors.New("advertise { rpc } must be set when running server+client on one agent")
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04). Data as JSON: /api/errors/aedebae61f7494f8. Report an issue: GitHub.