{"record":{"id":"f6e9995a00114fee","repo":"netbirdio/netbird","slug":"error-creating-tun-device-s","errorCode":null,"errorMessage":"error creating tun device: %s","messagePattern":"error creating tun device: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/iface/device/device_darwin.go","lineNumber":48,"sourceCode":"\tudpMux         *udpmux.UniversalUDPMuxDefault\n\tconfigurer     WGConfigurer\n}\n\nfunc NewTunDevice(name string, address wgaddr.Address, port int, key string, mtu uint16, iceBind *bind.ICEBind) *TunDevice {\n\treturn &TunDevice{\n\t\tname:    name,\n\t\taddress: address,\n\t\tport:    port,\n\t\tkey:     key,\n\t\tmtu:     mtu,\n\t\ticeBind: iceBind,\n\t}\n}\n\nfunc (t *TunDevice) Create() (WGConfigurer, error) {\n\ttunDevice, err := tun.CreateTUN(t.name, int(t.mtu))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error creating tun device: %s\", err)\n\t}\n\tt.filteredDevice = newDeviceFilter(tunDevice)\n\n\t// We need to create a wireguard-go device and listen to configuration requests\n\tt.device = device.NewDevice(\n\t\tt.filteredDevice,\n\t\tt.iceBind,\n\t\tdevice.NewLogger(wgLogLevel(), \"[netbird] \"),\n\t)\n\n\terr = t.assignAddr()\n\tif err != nil {\n\t\tt.device.Close()\n\t\treturn nil, fmt.Errorf(\"error assigning ip: %s\", err)\n\t}\n\n\tt.configurer = configurer.NewUSPConfigurer(t.device, t.name, t.iceBind.ActivityRecorder())\n\terr = t.configurer.ConfigureInterface(t.key, t.port)","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/iface/device/device_darwin.go#L30-L66","documentation":"Error \"error creating tun device: %s\" thrown in netbirdio/netbird.","triggerScenarios":"Thrown at client/iface/device/device_darwin.go:48 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c","analyzedAt":"2026-08-16T03:09:19.136Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}