hashicorp/nomad · error

-dev=connect uses network namespaces: %v

Error message

-dev=connect uses network namespaces: %v

What it means

In -dev-connect mode Nomad determines the public network interface via sockaddr.GetDefaultInterfaces() to bind the namespaced network. If that call fails, this (typo'd "-dev=connect") error message wraps the underlying error.

Source

Thrown at command/agent/config.go:1755

func (mode *devModeConfig) networkConfig() error {
	if runtime.GOOS == "windows" {
		mode.bindAddr = "127.0.0.1"
		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}

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Inspect the wrapped error for the failing syscall and fix the host/container network setup.
  2. Run with security profiles (seccomp/apparmor) that permit netlink socket calls.
  3. Fall back to regular -dev mode if the environment cannot expose interfaces.
Defensive patterns

Strategy: fallback

Validate before calling

ifAddrs, err := sockaddr.GetDefaultInterfaces()
if err != nil {
  // fall back to non-connect dev mode
}

Try / catch

ifAddrs, err := sockaddr.GetDefaultInterfaces()
if err != nil {
  return fmt.Errorf("could not detect default interface: %w", err)
}

Prevention

When it happens

Trigger: GetDefaultInterfaces returns an error during devModeConfig.networkConfig() — failing netlink/socket syscalls when enumerating interfaces (broken network stack, restricted namespaces).

Common situations: Containers with broken network namespace setup; seccomp/apparmor policies blocking interface enumeration; broken host networking.

Related errors


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