{"record":{"id":"28e8e6098f85a3a5","repo":"netbirdio/netbird","slug":"s-is-not-a-valid-input-for-s-it-should-be-an-ip","errorCode":null,"errorMessage":"%s is not a valid input for %s. it should be an IP string or a network name","messagePattern":"(.+?) is not a valid input for (.+?)\\. it should be an IP string or a network name","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"client/cmd/up.go","lineNumber":756,"sourceCode":"\tfor _, element := range list {\n\t\tif element == \"\" {\n\t\t\treturn fmt.Errorf(\"empty string is not a valid input for %s\", externalIPMapFlag)\n\t\t}\n\n\t\tsubElements := strings.Split(element, \"/\")\n\t\tif len(subElements) > 2 {\n\t\t\treturn fmt.Errorf(\"%s is not a valid input for %s. it should be formatted as \\\"String\\\" or \\\"String/String\\\"\", element, externalIPMapFlag)\n\t\t}\n\n\t\tif len(subElements) == 1 && !isValidIP(subElements[0]) {\n\t\t\treturn fmt.Errorf(\"%s is not a valid input for %s. it should be formatted as \\\"IP\\\" or \\\"IP/IP\\\", or \\\"IP/Interface Name\\\"\", element, externalIPMapFlag)\n\t\t}\n\n\t\tlast := 0\n\t\tfor _, singleElement := range subElements {\n\t\t\tinputType, err := validateElement(singleElement)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"%s is not a valid input for %s. it should be an IP string or a network name\", singleElement, externalIPMapFlag)\n\t\t\t}\n\t\t\tif last == interfaceInputType && inputType == interfaceInputType {\n\t\t\t\treturn fmt.Errorf(\"%s is not a valid input for %s. it should not contain two interface names\", element, externalIPMapFlag)\n\t\t\t}\n\t\t\tlast = inputType\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc parseInterfaceName(name string) error {\n\tif runtime.GOOS != \"darwin\" {\n\t\treturn nil\n\t}\n\n\tif strings.HasPrefix(name, \"utun\") {\n\t\treturn nil\n\t}","sourceCodeStart":738,"sourceCodeEnd":774,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/cmd/up.go#L738-L774","documentation":"After structural checks, every slash-separated sub-element of --external-ip-map goes through validateElement, which accepts only a valid IP or the name of an existing network interface. A sub-element matching neither yields this message. Note the difference from 431: this fires for parts of a pair, including the second member of \"IP/something\".","triggerScenarios":"Second element is neither IP nor an existing interface, e.g. \"1.2.3.4/eth9\" on a machine with no eth9, or \"1.2.3.4/1.2.3\" (malformed IP).","commonSituations":"Interface names differing across machines (eth0 vs ens192 vs enp0s3) in shared scripts; typos in interface names; malformed IP in the mask position.","solutions":["List valid interfaces first: `ip link` (Linux) / `ifconfig` (macOS)","Use an existing interface name or a correct IP literal for each part","For portable scripts, prefer an IP/IP pair instead of interface names"],"exampleFix":"# before (on a machine whose interface is ens192)\nnetbird up --external-ip-map \"192.0.2.10/eth0\"\n# after\nnetbird up --external-ip-map \"192.0.2.10/ens192\"","handlingStrategy":"validation","validationCode":"func validElement(e string) bool {\n\tif net.ParseIP(e) != nil {\n\t\treturn true\n\t}\n\tifaces, _ := net.Interfaces()\n\tfor _, i := range ifaces {\n\t\tif i.Name == e {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Generate interface-name values from net.Interfaces() at runtime instead of hardcoding","Prefer IP/IP pairs in cross-machine automation"],"tags":["go","netbird","cli","validation","nat","network-interface","external-ip-map"],"backgroundTag":null,"analyzedSha":"93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c","analyzedAt":"2026-08-16T03:09:19.136Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}