{"record":{"id":"8f8838fdd8bdd626","repo":"netbirdio/netbird","slug":"interface-name-not-found-in-ifconfig-output","errorCode":null,"errorMessage":"interface name not found in ifconfig output","messagePattern":"interface name not found in ifconfig output","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/iface/freebsd/iface.go","lineNumber":79,"sourceCode":"\t\t\tparts := strings.Fields(line)\n\t\t\tif len(parts) < 2 {\n\t\t\t\treturn nil, fmt.Errorf(\"failed to parse line: %s\", line)\n\t\t\t}\n\t\t\tgroup = parts[1]\n\t\t}\n\n\t\t// If line contains \"inet \", it's a line with IP address\n\t\tif strings.Contains(line, \"inet \") {\n\t\t\tparts := strings.Fields(line)\n\t\t\tif len(parts) < 2 {\n\t\t\t\treturn nil, fmt.Errorf(\"failed to parse line: %s\", line)\n\t\t\t}\n\t\t\tips = append(ips, parts[1])\n\t\t}\n\t}\n\n\tif name == \"\" {\n\t\treturn nil, fmt.Errorf(\"interface name not found in ifconfig output\")\n\t}\n\n\tmtuInt, err := strconv.Atoi(mtu)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to parse MTU: %w\", err)\n\t}\n\n\treturn &iface{\n\t\tName:    name,\n\t\tMTU:     mtuInt,\n\t\tGroup:   group,\n\t\tIPAddrs: ips,\n\t}, nil\n}\n\nfunc parseIFName(output []byte) (string, error) {\n\t// TODO: implement without allocations\n\tlines := strings.Split(string(output), \"\\n\")","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/iface/freebsd/iface.go#L61-L97","documentation":"Guard in parseIfconfigOutput: after scanning the ifconfig output line by line, no interface name was extracted (the name field stayed empty), meaning the output did not have the expected '<name>: flags=...' header. LinkByName cannot build an iface record, so parsing fails.","triggerScenarios":"Thrown at client/iface/freebsd/iface.go:79 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the interface exists with ifconfig -l","Check the command actually ran against the expected interface","Handle the not-found case before parsing"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c","analyzedAt":"2026-08-16T03:09:19.136Z","contentChangedAt":"2026-08-16T03:09:19.136Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}