{"record":{"id":"cf4d24a49adc8290","repo":"netbirdio/netbird","slug":"change-name-q-q-w","errorCode":null,"errorMessage":"change name %q -> %q: %w","messagePattern":"change name %q -> %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/iface/freebsd/link.go","lineNumber":152,"sourceCode":"\t\treturn \"\", fmt.Errorf(\"create %s interface: %w\", groupName, err)\n\t}\n\n\tinterfaceName, err := parseIFName(output)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"parse interface name: %w\", err)\n\t}\n\n\treturn interfaceName, nil\n}\n\nfunc (l *Link) rename(oldName, newName string) (string, error) {\n\tcmd := exec.Command(\"ifconfig\", oldName, \"name\", newName)\n\n\toutput, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\tlog.Debugf(\"ifconfig out: %s\", output)\n\n\t\treturn \"\", fmt.Errorf(\"change name %q -> %q: %w\", oldName, newName, err)\n\t}\n\n\tinterfaceName, err := parseIFName(output)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"parse new name: %w\", err)\n\t}\n\n\treturn interfaceName, nil\n}\n\nfunc (l *Link) del(name string) error {\n\tvar stderr bytes.Buffer\n\n\tcmd := exec.Command(\"ifconfig\", name, \"destroy\")\n\tcmd.Stderr = &stderr\n\n\terr := cmd.Run()\n\tif err != nil {","sourceCodeStart":134,"sourceCodeEnd":170,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/iface/freebsd/link.go#L134-L170","documentation":"rename() renames the freshly created interface with `ifconfig <old> name <new>` and wraps any non-zero exit. Typical kernel causes: the target name is already used by another interface, the new name exceeds the FreeBSD interface-name limit (IFNAMSIZ-1 = 15 characters), or the process lacks privileges.","triggerScenarios":"Add() after create() when the parsed name differs from the configured one; fails when l.name already exists, when the configured interface name is longer than 15 chars, or when run unprivileged.","commonSituations":"A leftover interface from a crashed run still holds the target name; custom interface name in configuration that is too long; two agents racing to take the same name.","solutions":["Check the target name is free: `ifconfig <name>` should report 'does not exist'","Destroy the stale holder with `sudo ifconfig <name> destroy`, then retry netbird up","Keep the configured interface name at or under 15 characters","Run the agent as root"],"exampleFix":"# before\n$ ifconfig wg0 name wt0\nifconfig: SIOCSIFNAME: File exists\n\n# after\n$ sudo ifconfig wt0 destroy\n$ sudo ifconfig wg0 name wt0","handlingStrategy":"validation","validationCode":"if len(newName) > 15 {\n    return fmt.Errorf(\"interface name %s exceeds FreeBSD IFNAMSIZ-1 (15 chars)\", newName)\n}\nif _, err := freebsd.LinkByName(newName); err == nil {\n    return fmt.Errorf(\"target interface name %s already exists\", newName)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Verify target name availability before renaming","Cap configured interface names at 15 characters","Run netbird down after crashes so stale names are released before the next up"],"tags":["go","freebsd","ifconfig","rename","interface"],"backgroundTag":null,"analyzedSha":"93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c","analyzedAt":"2026-08-16T03:09:19.136Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}