hashicorp/nomad · error
-dev=connect uses network namespaces: could not find public
Error message
-dev=connect uses network namespaces: could not find public network interface
What it means
When interface enumeration succeeds but returns an empty list, -dev-connect cannot find a public network interface to bind and returns this error (message rendered from the same typo'd format string) with the static reason.
Source
Thrown at command/agent/config.go:1758
mode.iface = "Loopback Pseudo-Interface 1"
return nil
}
if runtime.GOOS == "darwin" {
mode.bindAddr = "127.0.0.1"
mode.iface = "lo0"
return nil
}
if mode != nil && mode.connectMode {
// if we hit either of the errors here we're in a weird situation
// where syscalls to get the list of network interfaces are failing.
// rather than throwing errors, we'll fall back to the default.
ifAddrs, err := sockaddr.GetDefaultInterfaces()
errMsg := "-dev=connect uses network namespaces: %v"
if err != nil {
return fmt.Errorf(errMsg, err)
}
if len(ifAddrs) < 1 {
return fmt.Errorf(errMsg, "could not find public network interface")
}
iface := ifAddrs[0].Name
mode.iface = iface
mode.bindAddr = "0.0.0.0" // allows CLI to "just work"
return nil
}
mode.bindAddr = "127.0.0.1"
mode.iface = "lo"
return nil
}
// DevConfig is a Config that is used for dev mode of Nomad.
func DevConfig(mode *devModeConfig) *Config {
if mode == nil {
mode = &devModeConfig{defaultMode: true}
mode.networkConfig()
}
conf := DefaultConfig()View on GitHub (pinned to 482b49bf1a)
Solutions
- Ensure the environment has a routable non-loopback interface (attach a bridge/network).
- Use a different dev environment (host network, default docker bridge).
- Fall back to plain -dev mode which does not need a public interface.
Example fix
# before (no interfaces) docker run --network none nomad-dev nomad agent -dev-connect # after docker run --network bridge nomad-dev nomad agent -dev-connect
Defensive patterns
Strategy: fallback
Validate before calling
ifAddrs, _ := sockaddr.GetDefaultInterfaces()
if len(ifAddrs) == 0 {
return errors.New("no public interface; use a networked environment or -dev")
} Prevention
- Confirm `ip route get 1.1.1.1` resolves in the environment
- Avoid --network none / loopback-only netns for dev agents
- Prefer host or bridge networking for connect dev mode
When it happens
Trigger: sockaddr.GetDefaultInterfaces() returns 0 interfaces during networkConfig() — e.g. loopback-only containers, freshly created netns with no links configured.
Common situations: Running inside a minimal network namespace (ip netns with only lo); docker run --network none; VMs with interfaces not yet up.
Related errors
- -dev=connect uses network namespaces: %v
- -dev-connect uses network namespaces and is only supported f
- network namespace already exists but was misconfigured
- network already configured but not found in state
- no CNI network config found
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/d961cd99ef494940.
Report an issue: GitHub.