hashicorp/nomad · error

Failed to parse HTTP address: %v

Error message

Failed to parse HTTP address: %v

What it means

During agent config normalization, the HTTP bind address(es) (Addresses.HTTP, possibly a multi-IP template) are normalized against the default BindAddr via normalizeMultipleBind. If any address in the list fails to parse (invalid host, unparseable template result, bad IP), this error wraps and surfaces the underlying cause. It means the HTTP listener address could not be resolved to valid bind targets.

Source

Thrown at command/agent/config.go:2381

	nc.ExtraKeysHCL = slices.Clone(c.ExtraKeysHCL)
	return &nc
}

// normalizeAddrs normalizes Addresses and AdvertiseAddrs to always be
// initialized and have reasonable defaults.
func (c *Config) normalizeAddrs() error {
	if c.BindAddr != "" {
		ipStr, err := listenerutil.ParseSingleIPTemplate(c.BindAddr)
		if err != nil {
			return fmt.Errorf("Bind address resolution failed: %v", err)
		}
		c.BindAddr = ipStr
	}
	c.BindAddr = ipaddr.NormalizeAddr(c.BindAddr)

	httpAddrs, err := normalizeMultipleBind(c.Addresses.HTTP, c.BindAddr)
	if err != nil {
		return fmt.Errorf("Failed to parse HTTP address: %v", err)
	}
	c.Addresses.HTTP = strings.Join(httpAddrs, " ")

	addr, err := normalizeBind(c.Addresses.RPC, c.BindAddr)
	if err != nil {
		return fmt.Errorf("Failed to parse RPC address: %v", err)
	}
	c.Addresses.RPC = addr

	addr, err = normalizeBind(c.Addresses.Serf, c.BindAddr)
	if err != nil {
		return fmt.Errorf("Failed to parse Serf address: %v", err)
	}
	c.Addresses.Serf = addr

	c.normalizedAddrs = &NormalizedAddrs{
		RPC:  normalizeAddrWithPort(c.Addresses.RPC, c.Ports.RPC),
		Serf: normalizeAddrWithPort(c.Addresses.Serf, c.Ports.Serf),

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Check the addresses.http value in your config; fix the malformed address or template syntax
  2. Test the template with 'consul template'-style rendering or run with -dev to isolate the value
  3. Use a valid IP like 0.0.0.0 or 127.0.0.1 to confirm the rest of the config is fine
  4. Consult the wrapped %v detail: it names the actual parse failure

Example fix

// before
addresses { http = "{{ GetInterfaceIP \"eth0\"  " } // broken template
// after
addresses { http = "{{ GetInterfaceIP \"eth0\" }}" }
Defensive patterns

Strategy: validation

Validate before calling

func validAddrList(v string) bool {
	if v == "" { return true }
	for _, a := range strings.Fields(v) {
		if net.ParseIP(a) == nil { return false }
	}
	return true
}
// call before writing config: if !validAddrList(cfg.Addresses.HTTP) { fix }

Prevention

When it happens

Trigger: Setting addresses.http in the agent config (or -http-addr style config) to a value that normalizeMultipleBind cannot parse: a template that fails to render, an invalid IP/host string, or an empty/whitespace entry; also when bind is unset and the derived default is invalid.

Common situations: Typos in addresses.http; consul-template syntax errors in an interface-template expression; multiple addresses separated incorrectly (not space-delimited after template expansion); DNS name that does not resolve in the environment.

Understand the failure class

Related errors


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