{"record":{"id":"1aefdd629b7b4c2e","repo":"netbirdio/netbird","slug":"s-is-invalid-it-should-be-formatted-as-ip-port-s","errorCode":null,"errorMessage":"%s is invalid, it should be formatted as IP:Port string or as an empty string like \"\"","messagePattern":"(.+?) is invalid, it should be formatted as IP:Port string or as an empty string like \"\"","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/cmd/up.go","lineNumber":816,"sourceCode":"\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}\n\nfunc parseCustomDNSAddress(modified bool) ([]byte, error) {\n\tvar parsed []byte\n\tif modified {\n\t\tif !isValidAddrPort(customDNSAddress) {\n\t\t\treturn nil, fmt.Errorf(\"%s is invalid, it should be formatted as IP:Port string or as an empty string like \\\"\\\"\", customDNSAddress)\n\t\t}\n\t\tif customDNSAddress == \"\" && util.FindFirstLogPath(logFiles) != \"\" {\n\t\t\tparsed = []byte(\"empty\")\n\t\t} else {\n\t\t\tparsed = []byte(customDNSAddress)\n\t\t}\n\t}\n\treturn parsed, nil\n}\n\nfunc validateDnsLabels(labels []string) (domain.List, error) {\n\tvar (\n\t\tdomains domain.List\n\t\terr     error\n\t)\n\n\tif len(labels) == 0 {\n\t\treturn domains, nil","sourceCodeStart":798,"sourceCodeEnd":834,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/cmd/up.go#L798-L834","documentation":"Core validator behind --dns-resolver-address: isValidAddrPort accepts the empty string or anything netip.ParseAddrPort can parse; anything else triggers this message, which interpolates the offending value. When the flag was changed and the value is empty AND a log file path exists, the CLI instead sends the literal sentinel \"empty\" to explicitly reset the resolver — this error is the malformed-value path.","triggerScenarios":"`--dns-resolver-address` set to a bare IP (\"9.9.9.9\"), a hostname (\"dns.corp\"), an IPv6 without brackets, or a port out of range. The value must be \"IP:Port\" or \"\".","commonSituations":"Migrating from older builds that accepted host:port or IP-only; scripts injecting a variable that is sometimes just the IP.","solutions":["Use the strict IP:Port form: `--dns-resolver-address 9.9.9.9:53`","Use an explicit empty string to reset: `--dns-resolver-address \"\"`","For IPv6 use bracketed form: `[2001:db8::1]:53`"],"exampleFix":"# before\nnetbird up --dns-resolver-address 9.9.9.9\n# after\nnetbird up --dns-resolver-address 9.9.9.9:53","handlingStrategy":"validation","validationCode":"func validDNSAddr(s string) bool {\n\tif s == \"\" {\n\t\treturn true\n\t}\n\t_, err := netip.ParseAddrPort(s)\n\treturn err == nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Canonical form: IPv4 \"1.2.3.4:53\", IPv6 \"[2001:db8::1]:53\"","Reject hostnames upstream so users never get this far"],"tags":["go","netbird","cli","dns","validation","netip","flag-parsing"],"backgroundTag":null,"analyzedSha":"93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c","analyzedAt":"2026-08-16T03:09:19.136Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}