netbirdio/netbird · warning

%s is not a valid input for %s. it should be an IP string or

Error message

%s is not a valid input for %s. it should be an IP string or a network name

What it means

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".

Source

Thrown at client/cmd/up.go:756

	for _, element := range list {
		if element == "" {
			return fmt.Errorf("empty string is not a valid input for %s", externalIPMapFlag)
		}

		subElements := strings.Split(element, "/")
		if len(subElements) > 2 {
			return fmt.Errorf("%s is not a valid input for %s. it should be formatted as \"String\" or \"String/String\"", element, externalIPMapFlag)
		}

		if len(subElements) == 1 && !isValidIP(subElements[0]) {
			return 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)
		}

		last := 0
		for _, singleElement := range subElements {
			inputType, err := validateElement(singleElement)
			if err != nil {
				return fmt.Errorf("%s is not a valid input for %s. it should be an IP string or a network name", singleElement, externalIPMapFlag)
			}
			if last == interfaceInputType && inputType == interfaceInputType {
				return fmt.Errorf("%s is not a valid input for %s. it should not contain two interface names", element, externalIPMapFlag)
			}
			last = inputType
		}
	}
	return nil
}

func parseInterfaceName(name string) error {
	if runtime.GOOS != "darwin" {
		return nil
	}

	if strings.HasPrefix(name, "utun") {
		return nil
	}

View on GitHub (pinned to 93e97f4bf1)

Solutions

  1. List valid interfaces first: `ip link` (Linux) / `ifconfig` (macOS)
  2. Use an existing interface name or a correct IP literal for each part
  3. For portable scripts, prefer an IP/IP pair instead of interface names

Example fix

# before (on a machine whose interface is ens192)
netbird up --external-ip-map "192.0.2.10/eth0"
# after
netbird up --external-ip-map "192.0.2.10/ens192"
Defensive patterns

Strategy: validation

Validate before calling

func validElement(e string) bool {
	if net.ParseIP(e) != nil {
		return true
	}
	ifaces, _ := net.Interfaces()
	for _, i := range ifaces {
		if i.Name == e {
			return true
		}
	}
	return false
}

Prevention

When it happens

Trigger: 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).

Common situations: Interface names differing across machines (eth0 vs ens192 vs enp0s3) in shared scripts; typos in interface names; malformed IP in the mask position.

Related errors


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