netbirdio/netbird · warning

empty string is not a valid input for %s

Error message

empty string is not a valid input for %s

What it means

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.

Source

Thrown at client/cmd/up.go:740

	if cmd.Flag(blockLANAccessFlag).Changed {
		loginRequest.BlockLanAccess = &blockLANAccess
	}

	if cmd.Flag(blockInboundFlag).Changed {
		loginRequest.BlockInbound = &blockInbound
	}

	if cmd.Flag(disableIPv6Flag).Changed {
		loginRequest.DisableIpv6 = &disableIPv6
	}

	return &loginRequest, nil
}

func validateNATExternalIPs(list []string) error {
	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 {

View on GitHub (pinned to 93e97f4bf1)

Solutions

  1. Remove empty entries; use only non-empty IP/IP-or-interface values
  2. To clear the external IP mapping, omit the flag entirely rather than passing an empty string
  3. Fix the templating that emits empty list members

Example fix

# before
netbird up --external-ip-map ""
# after
netbird up  # flag omitted to clear the setting
Defensive patterns

Strategy: validation

Validate before calling

// drop empties before composing the flag
var parts []string
for _, p := range strings.Split(raw, ",") {
	if p = strings.TrimSpace(p); p != "" {
		parts = append(parts, p)
	}
}

Prevention

When it happens

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

Common situations: 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.

Related errors


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