hashicorp/nomad · error
cannot use address_mode="driver": no driver network exists
Error message
cannot use address_mode="driver": no driver network exists
What it means
GetAddress with AddressModeDriver requires a driver network in the allocation's networks; when no driver network exists (e.g. host networking only), driver address mode cannot resolve an IP and the registration fails.
Source
Thrown at client/serviceregistration/address.go:105
if port <= 0 {
return "", 0, fmt.Errorf("invalid port: %q: port must be >0", portLabel)
}
// A number was given which will use the Consul agent's address and the given port
// Returning a blank string as an address will use the Consul agent's address
return "", port, nil
}
return mapping.HostIP, mapping.Value, nil
case structs.AddressModeDriver:
// Cannot use address mode driver with custom advertise address.
if address != "" {
return "", 0, fmt.Errorf("cannot use custom advertise address with %q address mode", structs.AddressModeDriver)
}
// Require a driver network if driver address mode is used
if driverNet == nil {
return "", 0, fmt.Errorf(`cannot use address_mode="driver": no driver network exists`)
}
// If no port label is specified just return the IP
if portLabel == "" {
return driverNet.IP, 0, nil
}
// If the port is a label, use the driver's port (not the host's)
if port, ok := ports.Get(portLabel); ok {
return driverNet.IP, port.To, nil
}
// Check if old style driver portmap is used
if port, ok := driverNet.PortMap[portLabel]; ok {
return driverNet.IP, port, nil
}
// If port isn't a label, try to parse it as a literal port numberView on GitHub (pinned to 482b49bf1a)
Solutions
- Use a task driver that provides a network when address_mode="driver"
- Switch address_mode to "host" or "auto" for non-driver-network tasks
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at client/serviceregistration/address.go:105 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/1b80a6e241d77f8f.
Report an issue: GitHub.