netbirdio/netbird · warning

failed to validate dns labels: %v

Error message

failed to validate dns labels: %v

What it means

Thin wrapper around domain.ValidateDomains for the --extra-dns-labels flag (validated once in up.go's initialization path). Each label must be a syntactically valid domain; the wrapped error from the shared dns/domain package names the first invalid label. Empty label lists pass through cleanly, so this only fires when at least one label was supplied and one is malformed.

Source

Thrown at client/cmd/up.go:839

			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
	}

	domains, err = domain.ValidateDomains(labels)
	if err != nil {
		return nil, fmt.Errorf("failed to validate dns labels: %v", err)
	}

	return domains, nil
}

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

View on GitHub (pinned to 93e97f4bf1)

Solutions

  1. Use valid DNS labels: letters, digits, hyphens (not leading/trailing), 1-63 chars per label
  2. Strip trailing dots from pasted FQDNs
  3. Remove the flag if the labels are unnecessary

Example fix

# before
netbird up --extra-dns-labels "my_app"
# after
netbird up --extra-dns-labels "my-app"
Defensive patterns

Strategy: validation

Validate before calling

if _, err := domain.ValidateDomains(labels); err != nil {
	return fmt.Errorf("fix dns labels before up: %w", err)
}

Prevention

When it happens

Trigger: `netbird up --extra-dns-labels "bad_domain"` (underscore), a label with a leading/trailing dot or hyphen, or a label over 63 characters.

Common situations: Using internal shorthand names that are not legal DNS labels, or trailing dots from copy-pasting FQDNs.

Related errors


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