netbirdio/netbird · error

parse new name: %w

Error message

parse new name: %w

What it means

Same parser as the create path: after `ifconfig <old> name <new>` exits successfully, parseIFName must find exactly one token on the first output line (the new name, e.g. 'wg1'). This error means the rename itself succeeded at the ifconfig level but the output could not be parsed, so the code cannot confirm the resulting interface name.

Source

Thrown at client/iface/freebsd/link.go:157

		return "", fmt.Errorf("parse interface name: %w", err)
	}

	return interfaceName, nil
}

func (l *Link) rename(oldName, newName string) (string, error) {
	cmd := exec.Command("ifconfig", oldName, "name", newName)

	output, err := cmd.CombinedOutput()
	if err != nil {
		log.Debugf("ifconfig out: %s", output)

		return "", fmt.Errorf("change name %q -> %q: %w", oldName, newName, err)
	}

	interfaceName, err := parseIFName(output)
	if err != nil {
		return "", fmt.Errorf("parse new name: %w", err)
	}

	return interfaceName, nil
}

func (l *Link) del(name string) error {
	var stderr bytes.Buffer

	cmd := exec.Command("ifconfig", name, "destroy")
	cmd.Stderr = &stderr

	err := cmd.Run()
	if err != nil {
		log.Debugf("ifconfig out: %s", stderr.String())

		return fmt.Errorf("destroy %s interface: %w", name, err)
	}

View on GitHub (pinned to 93e97f4bf1)

Solutions

  1. Run the rename manually and inspect the exact first output line
  2. Bypass wrappers by invoking /usr/sbin/ifconfig directly
  3. Confirm the result independently with `ifconfig -l` or net.InterfaceByName(newName)
  4. Normalize output (trim spaces and CR) before parsing if you fork this code
Defensive patterns

Strategy: fallback

Validate before calling

first := strings.SplitN(strings.TrimSpace(string(output)), "\n", 2)[0]
if len(strings.Fields(first)) != 1 {
    return fmt.Errorf("unexpected ifconfig rename output: %q", first)
}

Prevention

When it happens

Trigger: rename() succeeds but prints nothing on the first line or more than one token on it: wrappers around ifconfig, unexpected format for the running FreeBSD version, or CRLF artifacts.

Common situations: Shimmed ifconfig on the daemon PATH; output format drift across OS versions; localized output.

Related errors


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