netbirdio/netbird · error

%s is invalid, it should be formatted as IP:Port string or a

Error message

%s is invalid, it should be formatted as IP:Port string or as an empty string like ""

What it means

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.

Source

Thrown at client/cmd/up.go:816

func isValidInterface(name string) (bool, error) {
	netInterfaces, err := net.Interfaces()
	if err != nil {
		return false, err
	}
	for _, iface := range netInterfaces {
		if iface.Name == name {
			return true, nil
		}
	}
	return false, nil
}

func parseCustomDNSAddress(modified bool) ([]byte, error) {
	var parsed []byte
	if modified {
		if !isValidAddrPort(customDNSAddress) {
			return nil, fmt.Errorf("%s is invalid, it should be formatted as IP:Port string or as an empty string like \"\"", customDNSAddress)
		}
		if customDNSAddress == "" && util.FindFirstLogPath(logFiles) != "" {
			parsed = []byte("empty")
		} else {
			parsed = []byte(customDNSAddress)
		}
	}
	return parsed, nil
}

func validateDnsLabels(labels []string) (domain.List, error) {
	var (
		domains domain.List
		err     error
	)

	if len(labels) == 0 {
		return domains, nil

View on GitHub (pinned to 93e97f4bf1)

Solutions

  1. Use the strict IP:Port form: `--dns-resolver-address 9.9.9.9:53`
  2. Use an explicit empty string to reset: `--dns-resolver-address ""`
  3. For IPv6 use bracketed form: `[2001:db8::1]:53`

Example fix

# before
netbird up --dns-resolver-address 9.9.9.9
# after
netbird up --dns-resolver-address 9.9.9.9:53
Defensive patterns

Strategy: validation

Validate before calling

func validDNSAddr(s string) bool {
	if s == "" {
		return true
	}
	_, err := netip.ParseAddrPort(s)
	return err == nil
}

Prevention

When it happens

Trigger: `--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 "".

Common situations: Migrating from older builds that accepted host:port or IP-only; scripts injecting a variable that is sometimes just the IP.

Related errors


AI-assisted analysis of netbirdio/netbird@93e97f4bf1 (2026-08-16). Data as JSON: /api/errors/1aefdd629b7b4c2e. Report an issue: GitHub.