{"record":{"id":"386d218dfa7eb52c","repo":"netbirdio/netbird","slug":"parse-new-name-w","errorCode":null,"errorMessage":"parse new name: %w","messagePattern":"parse new name: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/iface/freebsd/link.go","lineNumber":157,"sourceCode":"\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 {\n\t\tlog.Debugf(\"ifconfig out: %s\", stderr.String())\n\n\t\treturn fmt.Errorf(\"destroy %s interface: %w\", name, err)\n\t}\n","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/iface/freebsd/link.go#L139-L175","documentation":"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.","triggerScenarios":"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.","commonSituations":"Shimmed ifconfig on the daemon PATH; output format drift across OS versions; localized output.","solutions":["Run the rename manually and inspect the exact first output line","Bypass wrappers by invoking /usr/sbin/ifconfig directly","Confirm the result independently with `ifconfig -l` or net.InterfaceByName(newName)","Normalize output (trim spaces and CR) before parsing if you fork this code"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"first := strings.SplitN(strings.TrimSpace(string(output)), \"\\n\", 2)[0]\nif len(strings.Fields(first)) != 1 {\n    return fmt.Errorf(\"unexpected ifconfig rename output: %q\", first)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Do not wrap ifconfig in scripts or aliases on the daemon PATH","Confirm rename results with net.InterfaceByName(newName) instead of trusting output text"],"tags":["go","freebsd","ifconfig","parsing","rename"],"backgroundTag":null,"analyzedSha":"93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c","analyzedAt":"2026-08-16T03:09:19.136Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}