{"record":{"id":"f3cd1f69e61a629b","repo":"slackhq/nebula","slug":"write-failed-w","errorCode":null,"errorMessage":"Write failed: %w","messagePattern":"Write failed: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"wintun/tun.go","lineNumber":178,"sourceCode":"\t\treturn 0, os.ErrClosed\n\t}\n\n\tpacketSize := len(buff) - offset\n\ttun.rate.update(uint64(packetSize))\n\n\tpacket, err := tun.session.AllocateSendPacket(packetSize)\n\tif err == nil {\n\t\tcopy(packet, buff[offset:])\n\t\ttun.session.SendPacket(packet)\n\t\treturn packetSize, nil\n\t}\n\tswitch err {\n\tcase windows.ERROR_HANDLE_EOF:\n\t\treturn 0, os.ErrClosed\n\tcase windows.ERROR_BUFFER_OVERFLOW:\n\t\treturn 0, nil // Dropping when ring is full.\n\t}\n\treturn 0, fmt.Errorf(\"Write failed: %w\", err)\n}\n\n// LUID returns Windows interface instance ID.\nfunc (tun *NativeTun) LUID() uint64 {\n\ttun.running.Add(1)\n\tdefer tun.running.Done()\n\tif atomic.LoadInt32(&tun.close) == 1 {\n\t\treturn 0\n\t}\n\treturn tun.wt.LUID()\n}\n\n// RunningVersion returns the running version of the Wintun driver.\nfunc (tun *NativeTun) RunningVersion() (version uint32, err error) {\n\treturn wintun.RunningVersion()\n}\n\nfunc (rate *rateJuggler) update(packetLen uint64) {","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/slackhq/nebula/blob/dd8f660c0ac37903ec4080ca4d3c861ba9342ceb/wintun/tun.go#L160-L196","documentation":"Catch-all wrapping error in NativeTun.Write: AllocateSendPacket failed with an error other than the handled ERROR_HANDLE_EOF (closed) and ERROR_BUFFER_OVERFLOW (ring full, silently dropped). An unexpected Wintun failure allocating a send packet; the error is preserved with %w for upstream inspection.","triggerScenarios":"Thrown at wintun/tun.go:178 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the write after a brief pause","Recreate the TUN session if allocation keeps failing","Inspect the wrapped Windows error for driver-level diagnosis"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"dd8f660c0ac37903ec4080ca4d3c861ba9342ceb","analyzedAt":"2026-09-03T11:13:55.444Z","contentChangedAt":"2026-09-03T11:13:55.444Z","schemaVersion":2},"datasetVersion":"2026-09-10T17:17:09.494Z"}