{"record":{"id":"6a1fc90682cbf2a4","repo":"zed-industries/zed","slug":"wsastartup-failed","errorCode":null,"errorMessage":"WSAStartup failed: {}","messagePattern":"WSAStartup failed: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"crates/net/src/util.rs","lineNumber":18,"sourceCode":"use std::{\n    io::{Error, ErrorKind, Result},\n    path::Path,\n    sync::Once,\n};\n\nuse windows::Win32::Networking::WinSock::{\n    ADDRESS_FAMILY, AF_UNIX, SOCKADDR_UN, SOCKET_ERROR, WSAGetLastError, WSAStartup,\n};\n\npub(crate) fn init() {\n    static ONCE: Once = Once::new();\n\n    ONCE.call_once(|| unsafe {\n        let mut wsa_data = std::mem::zeroed();\n        let result = WSAStartup(0x202, &mut wsa_data);\n        if result != 0 {\n            panic!(\"WSAStartup failed: {}\", result);\n        }\n    });\n}\n\n// https://devblogs.microsoft.com/commandline/af_unix-comes-to-windows/\npub(crate) fn sockaddr_un<P: AsRef<Path>>(path: P) -> Result<(SOCKADDR_UN, usize)> {\n    let mut addr = SOCKADDR_UN::default();\n    addr.sun_family = ADDRESS_FAMILY(AF_UNIX);\n\n    let bytes = path\n        .as_ref()\n        .to_str()\n        .map(|s| s.as_bytes())\n        .ok_or(ErrorKind::InvalidInput)?;\n\n    if bytes.contains(&0) {\n        return Err(Error::new(\n            ErrorKind::InvalidInput,","sourceCodeStart":1,"sourceCodeEnd":36,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/net/src/util.rs#L1-L36","documentation":"On Windows, the net crate initializes Winsock once with WSAStartup(0x0202) before creating sockets (including AF_UNIX ones). If WSAStartup returns a non-zero error, the process panics on first network use. Winsock startup failures are almost always system-level problems - a corrupted Winsock catalog, resource exhaustion, or a damaged Windows image - not application bugs.","triggerScenarios":"The first call into net::util::init() (any socket creation in the crate) on Windows when WSAStartup fails: a corrupt Winsock service-provider catalog (LSP damage from VPN/antivirus/firewall filter drivers), system resource exhaustion, or a broken system image.","commonSituations":"After installing or removing VPN, antivirus, or network-filter software that hooked Winsock and left the catalog damaged; heavily loaded machines; installations where other networking apps also fail with WSA errors.","solutions":["Run 'netsh winsock reset' as administrator and reboot - this rebuilds the catalog and fixes the most common cause","Uninstall or update recently added VPN/antivirus/network-filter software that hooks Winsock","Verify basic networking works system-wide (other apps, a tiny socket test program)","If it persists, run sfc /scannow and repair the Windows image, then retry"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Include 'netsh winsock reset' plus reboot in the remediation runbook for Windows networking failures","Prefer WFP-based firewall/VPN software over LSP-style Winsock hooks that can corrupt the catalog","Smoke-test socket creation when provisioning Windows machines that will run the app"],"tags":["windows","winsock","network","initialization","panic"],"backgroundTag":"winsock-initialization-failed","analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}