{"record":{"id":"59df3a2bb449ae99","repo":"netbirdio/netbird","slug":"empty-string-is-not-a-valid-input-for-s","errorCode":null,"errorMessage":"empty string is not a valid input for %s","messagePattern":"empty string is not a valid input for (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"client/cmd/up.go","lineNumber":740,"sourceCode":"\tif cmd.Flag(blockLANAccessFlag).Changed {\n\t\tloginRequest.BlockLanAccess = &blockLANAccess\n\t}\n\n\tif cmd.Flag(blockInboundFlag).Changed {\n\t\tloginRequest.BlockInbound = &blockInbound\n\t}\n\n\tif cmd.Flag(disableIPv6Flag).Changed {\n\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 {","sourceCodeStart":722,"sourceCodeEnd":758,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/cmd/up.go#L722-L758","documentation":"First check in validateNATExternalIPs: every element of the --external-ip-map slice must be non-empty. The flag is a StringSlice, so an entry like \"\" (from `--external-ip-map \"\"` or a trailing comma producing an empty element) is rejected before any IP or interface parsing happens.","triggerScenarios":"`netbird up --external-ip-map \"\"`, or a comma-separated list with an empty member such as \"1.2.3.4,,5.6.7.8\" or a trailing comma.","commonSituations":"Scripts building the flag from a variable that is empty, YAML/JSON templating that leaves a blank list item, or users trying to 'clear' the setting with an empty string.","solutions":["Remove empty entries; use only non-empty IP/IP-or-interface values","To clear the external IP mapping, omit the flag entirely rather than passing an empty string","Fix the templating that emits empty list members"],"exampleFix":"# before\nnetbird up --external-ip-map \"\"\n# after\nnetbird up  # flag omitted to clear the setting","handlingStrategy":"validation","validationCode":"// drop empties before composing the flag\nvar parts []string\nfor _, p := range strings.Split(raw, \",\") {\n\tif p = strings.TrimSpace(p); p != \"\" {\n\t\tparts = append(parts, p)\n\t}\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never pass \"\" to --external-ip-map; omit the flag to clear","Trim and filter list members when generating the flag from templates"],"tags":["go","netbird","cli","validation","nat","external-ip-map"],"backgroundTag":null,"analyzedSha":"93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c","analyzedAt":"2026-08-16T03:09:19.136Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}