{"record":{"id":"8d1d5ab05bd29087","repo":"netchx/netch","slug":"pleases-install-pcap2socks-s-dependency","errorCode":null,"errorMessage":"Pleases install pcap2socks's dependency","messagePattern":"Pleases install pcap2socks's dependency","errorType":"exception","errorClass":"MessageException","httpStatus":null,"severity":"error","filePath":"Netch/Controllers/PcapController.cs","lineNumber":94,"sourceCode":"    }\n\n    protected override void OnStarted()\n    {\n        Global.MainForm.BeginInvoke(() => _form.Show());\n    }\n\n    protected override void OnStartFailed()\n    {\n        if (new FileInfo(LogPath).Length == 0)\n        {\n            Task.Run(() =>\n                {\n                    Thread.Sleep(1000);\n                    Utils.Utils.Open(\"https://github.com/zhxie/pcap2socks#dependencies\");\n                })\n                .Forget();\n\n            throw new MessageException(\"Pleases install pcap2socks's dependency\");\n        }\n\n        Utils.Utils.Open(LogPath);\n    }\n}","sourceCodeStart":76,"sourceCodeEnd":99,"githubUrl":"https://github.com/netchx/netch/blob/9d99eb1c5a2acbf2a34f2600f94242601019a300/Netch/Controllers/PcapController.cs#L76-L99","documentation":"Thrown by PcapController.OnStartFailed when the pcap2socks log file is empty (Length == 0), interpreted as pcap2socks having died before producing any output — the classic signature of a missing Npcap/WinPcap capture dependency. Before throwing, it spawns a task that opens the pcap2socks dependencies URL after a 1-second delay.","triggerScenarios":"pcap2socks started, immediately exited because no packet capture driver (Npcap) is installed, and wrote nothing to its log; the ShareMode (PcapController) was selected on a machine without Npcap.","commonSituations":"Fresh Windows install with Netch but no Npcap; Npcap uninstalled; Npcap installed without the 'WinPcap API-compatible Mode' option; user picked ShareMode by mistake.","solutions":["Install Npcap (the URL the controller opens: github.com/zhxie/pcap2socks#dependencies) with the WinPcap-compatible DLL option.","Restart Netch after installing Npcap.","Verify Npcap is present: look for 'NPCAP' in `getcap -D` or the installed programs list.","If you didn't mean to use pcap2socks, switch the mode away from ShareMode."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Detect the missing capture dependency before offering ShareMode.\nbool npcapInstalled = Directory.GetFiles(Environment.SystemDirectory, \"wpcap.dll\").Any()\n    || Directory.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.System), \"Packet.dll\").Any();\nif (!npcapInstalled)\n    throw new MessageException(\"pcap2socks requires Npcap to be installed.\");","typeGuard":null,"tryCatchPattern":"try { await pcapController.StartAsync(server, mode); }\ncatch (MessageException ex) when (ex.Message.Contains(\"pcap2socks's dependency\"))\n{\n    // The controller already opened the dependencies URL; prompt the user to install Npcap and restart.\n    PromptInstallNpcapAndRestart();\n}","preventionTips":["Install Npcap with the WinPcap API-compatible option before first use of ShareMode.","Disable ShareMode in the UI when Npcap isn't detected.","Reinstall Npcap if the ShareMode suddenly starts failing after an OS reset.","Prefer TUN mode if you don't want a capture driver dependency."],"tags":["dependency","pcap","share-mode","startup"],"backgroundTag":null,"analyzedSha":"9d99eb1c5a2acbf2a34f2600f94242601019a300","analyzedAt":"2026-08-13T14:12:19.105Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}