{"record":{"id":"881f8d0c2f4d79e4","repo":"netbirdio/netbird","slug":"invalid-ip-or-network-interface-name-not-found","errorCode":null,"errorMessage":"invalid IP or network interface name not found","messagePattern":"invalid IP or network interface name not found","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"client/cmd/up.go","lineNumber":792,"sourceCode":"\t}\n\n\treturn fmt.Errorf(\"invalid interface name %s. Please use the prefix utun followed by a number on MacOS. e.g., utun1 or utun199\", name)\n}\n\nfunc validateElement(element string) (int, error) {\n\tif isValidIP(element) {\n\t\treturn ipInputType, nil\n\t}\n\tvalidIface, err := isValidInterface(element)\n\tif err != nil {\n\t\treturn invalidInputType, fmt.Errorf(\"unable to validate the network interface name, error: %s\", err)\n\t}\n\n\tif validIface {\n\t\treturn interfaceInputType, nil\n\t}\n\n\treturn interfaceInputType, fmt.Errorf(\"invalid IP or network interface name not found\")\n}\n\nfunc isValidIP(ip string) bool {\n\treturn net.ParseIP(ip) != nil\n}\n\nfunc isValidInterface(name string) (bool, error) {\n\tnetInterfaces, err := net.Interfaces()\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tfor _, iface := range netInterfaces {\n\t\tif iface.Name == name {\n\t\t\treturn true, nil\n\t\t}\n\t}\n\treturn false, nil\n}","sourceCodeStart":774,"sourceCodeEnd":810,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/cmd/up.go#L774-L810","documentation":"validateElement is the leaf classifier for --external-ip-map values: it returns ipInputType for a valid IP, else queries net.Interfaces() for a matching interface name. When the value is not a valid IP and no interface with that name exists, this 'invalid IP or network interface name not found' error is returned (with interfaceInputType as a placeholder type the caller discards).","triggerScenarios":"A sub-element like \"10.0.0.x\" (malformed IP) or \"eth0 \" (whitespace-padded interface name) or an interface that exists on another host but not this one.","commonSituations":"Whitespace from quoted scripts, stale interface names after hardware/NIC renaming, or values written for a different machine in a shared config.","solutions":["Check the exact string for typos and stray whitespace","Confirm the interface exists locally (`ip link` / `ifconfig`) or replace it with an IP literal","Fix the malformed IP"],"exampleFix":"# before\nnetbird up --external-ip-map \"192.0.2.10/eth0 \"\n# after\nnetbird up --external-ip-map \"192.0.2.10/eth0\"","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"func isIPOrExistingInterface(v string) bool {\n\tif net.ParseIP(v) != nil {\n\t\treturn true\n\t}\n\tifaces, err := net.Interfaces()\n\tif err != nil {\n\t\treturn false\n\t}\n\tfor _, i := range ifaces {\n\t\tif i.Name == v {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}","tryCatchPattern":null,"preventionTips":["Trim whitespace from templated values","Re-validate after NIC changes (names drift across reboots/cloud images)"],"tags":["go","netbird","cli","validation","nat","external-ip-map","ip-parsing"],"backgroundTag":null,"analyzedSha":"93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c","analyzedAt":"2026-08-16T03:09:19.136Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}