hashicorp/nomad · error
cannot use custom advertise address with %q address mode
Error message
cannot use custom advertise address with %q address mode
What it means
GetAddress rejects combining a custom advertise address with AddressModeDriver: an explicit address was given while address_mode=driver, which requires using the driver-assigned network IP, so the request is invalid and fails registration address resolution.
Source
Thrown at client/serviceregistration/address.go:55
// the group network address is DIY. (e.g. EC2 public address)
if mapping, exists := ports.Get(portLabel); exists {
return address, mapping.Value, nil
}
// If not a port map we can interpolate a numeric port for you.
port, err := strconv.Atoi(portLabel)
if err != nil {
return "", 0, fmt.Errorf("invalid port: %q: not a valid port mapping or numeric port", portLabel)
}
return address, port, nil
case driverNet.Advertise():
return GetAddress("", structs.AddressModeDriver, portLabel, networks, driverNet, ports, netStatus)
default:
return GetAddress("", structs.AddressModeHost, portLabel, networks, driverNet, ports, netStatus)
}
case structs.AddressModeHost:
// Cannot use address mode host with custom advertise address.
if address != "" {
return "", 0, fmt.Errorf("cannot use custom advertise address with %q address mode", structs.AddressModeHost)
}
if portLabel == "" {
if len(networks) != 1 {
// If no networks are specified return zero
// values. Consul will advertise the host IP
// with no port. This is the pre-0.7.1 behavior
// some people rely on.
return "", 0, nil
}
return networks[0].IP, 0, nil
}
// Default path: use host ip:port
// Try finding port in the AllocatedPorts struct first
// Check in Networks struct for backwards compatibility if not found
mapping, ok := ports.Get(portLabel)
if !ok {View on GitHub (pinned to 482b49bf1a)
Solutions
- Remove the explicit address when using address_mode="driver"
- Use address_mode="host" or "auto" if a custom advertise address is required
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at client/serviceregistration/address.go:55 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/771a13cc0421ed1f.
Report an issue: GitHub.