{"record":{"id":"c5637baa769f8462","repo":"slackhq/nebula","slug":"read-failed-w","errorCode":null,"errorMessage":"Read failed: %w","messagePattern":"Read failed: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"wintun/tun.go","lineNumber":148,"sourceCode":"\t\tcase nil:\n\t\t\tpacketSize := len(packet)\n\t\t\tcopy(buff[offset:], packet)\n\t\t\ttun.session.ReleaseReceivePacket(packet)\n\t\t\ttun.rate.update(uint64(packetSize))\n\t\t\treturn packetSize, nil\n\t\tcase windows.ERROR_NO_MORE_ITEMS:\n\t\t\tif !shouldSpin || uint64(nanotime()-start) >= spinloopDuration {\n\t\t\t\twindows.WaitForSingleObject(tun.readWait, windows.INFINITE)\n\t\t\t\tgoto retry\n\t\t\t}\n\t\t\tprocyield(1)\n\t\t\tcontinue\n\t\tcase windows.ERROR_HANDLE_EOF:\n\t\t\treturn 0, os.ErrClosed\n\t\tcase windows.ERROR_INVALID_DATA:\n\t\t\treturn 0, errors.New(\"Send ring corrupt\")\n\t\t}\n\t\treturn 0, fmt.Errorf(\"Read failed: %w\", err)\n\t}\n}\n\nfunc (tun *NativeTun) Flush() error {\n\treturn nil\n}\n\nfunc (tun *NativeTun) Write(buff []byte, offset int) (int, error) {\n\ttun.running.Add(1)\n\tdefer tun.running.Done()\n\tif atomic.LoadInt32(&tun.close) == 1 {\n\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)","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/slackhq/nebula/blob/dd8f660c0ac37903ec4080ca4d3c861ba9342ceb/wintun/tun.go#L130-L166","documentation":"Catch-all wrapping error at the end of NativeTun.Read's switch: ReceivePacket returned an error other than the handled cases (ERROR_NO_MORE_ITEMS, ERROR_HANDLE_EOF, ERROR_INVALID_DATA). An unexpected Wintun driver error on read; preserved with %w. Handled cases exit earlier, so reaching this line is abnormal.","triggerScenarios":"Thrown at wintun/tun.go:148 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the read — transient driver errors often clear","Recreate the TUN device if the error persists","Report the wrapped Windows error code to diagnose the driver state"],"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"}