{"record":{"id":"d961cd99ef494940","repo":"hashicorp/nomad","slug":"dev-connect-uses-network-namespaces-could-not-fi","errorCode":null,"errorMessage":"-dev=connect uses network namespaces: could not find public network interface","messagePattern":"-dev=connect uses network namespaces: could not find public network interface","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"command/agent/config.go","lineNumber":1758,"sourceCode":"\t\tmode.iface = \"Loopback Pseudo-Interface 1\"\n\t\treturn nil\n\t}\n\tif runtime.GOOS == \"darwin\" {\n\t\tmode.bindAddr = \"127.0.0.1\"\n\t\tmode.iface = \"lo0\"\n\t\treturn nil\n\t}\n\tif mode != nil && mode.connectMode {\n\t\t// if we hit either of the errors here we're in a weird situation\n\t\t// where syscalls to get the list of network interfaces are failing.\n\t\t// rather than throwing errors, we'll fall back to the default.\n\t\tifAddrs, err := sockaddr.GetDefaultInterfaces()\n\t\terrMsg := \"-dev=connect uses network namespaces: %v\"\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(errMsg, err)\n\t\t}\n\t\tif len(ifAddrs) < 1 {\n\t\t\treturn fmt.Errorf(errMsg, \"could not find public network interface\")\n\t\t}\n\t\tiface := ifAddrs[0].Name\n\t\tmode.iface = iface\n\t\tmode.bindAddr = \"0.0.0.0\" // allows CLI to \"just work\"\n\t\treturn nil\n\t}\n\tmode.bindAddr = \"127.0.0.1\"\n\tmode.iface = \"lo\"\n\treturn nil\n}\n\n// DevConfig is a Config that is used for dev mode of Nomad.\nfunc DevConfig(mode *devModeConfig) *Config {\n\tif mode == nil {\n\t\tmode = &devModeConfig{defaultMode: true}\n\t\tmode.networkConfig()\n\t}\n\tconf := DefaultConfig()","sourceCodeStart":1740,"sourceCodeEnd":1776,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/command/agent/config.go#L1740-L1776","documentation":"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.","triggerScenarios":"sockaddr.GetDefaultInterfaces() returns 0 interfaces during networkConfig() — e.g. loopback-only containers, freshly created netns with no links configured.","commonSituations":"Running inside a minimal network namespace (ip netns with only lo); docker run --network none; VMs with interfaces not yet up.","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."],"exampleFix":"# before (no interfaces)\ndocker run --network none nomad-dev nomad agent -dev-connect\n# after\ndocker run --network bridge nomad-dev nomad agent -dev-connect","handlingStrategy":"fallback","validationCode":"ifAddrs, _ := sockaddr.GetDefaultInterfaces()\nif len(ifAddrs) == 0 {\n  return errors.New(\"no public interface; use a networked environment or -dev\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["network","dev-connect","interfaces","containers"],"backgroundTag":"no-network-interface","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}