{"record":{"id":"9bb50e34ea902115","repo":"netbirdio/netbird","slug":"s-is-not-a-valid-input-for-s-it-should-be-forma-9bb50e","errorCode":null,"errorMessage":"%s is not a valid input for %s. it should be formatted as \"IP\" or \"IP/IP\", or \"IP/Interface Name\"","messagePattern":"(.+?) is not a valid input for (.+?)\\. it should be formatted as \"IP\" or \"IP/IP\", or \"IP/Interface Name\"","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"client/cmd/up.go","lineNumber":749,"sourceCode":"\t\tloginRequest.DisableIpv6 = &disableIPv6\n\t}\n\n\treturn &loginRequest, nil\n}\n\nfunc validateNATExternalIPs(list []string) error {\n\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 {","sourceCodeStart":731,"sourceCodeEnd":767,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/cmd/up.go#L731-L767","documentation":"When a --external-ip-map element contains no '/', it is unambiguously an IP (an interface-only single value makes no sense for NAT mapping), so validateNATExternalIPs requires subElements[0] to parse via net.ParseIP. A single value that is not a valid IP hits this branch.","triggerScenarios":"`netbird up --external-ip-map eth0` (interface name without a pairing IP) or \"myhost.example.com\" (DNS names are not resolved), or a malformed IP like \"1.2.3.256\".","commonSituations":"Users assuming an interface name alone is valid, or passing hostnames — the validator only accepts literal IPs.","solutions":["Pair the interface with an IP: \"1.2.3.4/eth0\"","Resolve any hostname to an IP before passing it","Fix malformed IP literals"],"exampleFix":"# before\nnetbird up --external-ip-map eth0\n# after\nnetbird up --external-ip-map \"192.0.2.10/eth0\"","handlingStrategy":"validation","validationCode":"for _, e := range list {\n\tif !strings.Contains(e, \"/\") && net.ParseIP(e) == nil {\n\t\treturn fmt.Errorf(\"single value %q must be a literal IP\", e)\n\t}\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Interface-only values are invalid; always pair an interface with an IP","Resolve hostnames to IPs yourself before passing them"],"tags":["go","netbird","cli","validation","nat","ip-parsing","external-ip-map"],"backgroundTag":null,"analyzedSha":"93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c","analyzedAt":"2026-08-16T03:09:19.136Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}