{"record":{"id":"127244f1488f1cbd","repo":"zed-industries/zed","slug":"zed-wsl-sandbox-helper-is-not-valid-utf-8","errorCode":null,"errorMessage":"ZED_WSL_SANDBOX_HELPER is not valid UTF-8","messagePattern":"ZED_WSL_SANDBOX_HELPER is not valid UTF-8","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/sandbox/src/windows_wsl.rs","lineNumber":868,"sourceCode":"/// inside WSL and return its absolute in-WSL path, to be `--exec`'d as the\n/// `--wsl-sandbox-helper`. Runs [`HELPER_PROVISION_SCRIPT`] (which downloads the\n/// matching release tarball into an off-`PATH` location on first use).\n///\n/// Successful resolutions are cached per `(distro, channel, version)` for the\n/// life of the process — once provisioned, the path won't change. Failures are\n/// not cached, so a user who installs `curl` (or fixes networking) after an\n/// error can retry without restarting Zed.\nasync fn ensure_wsl_zed_helper(\n    wsl_exe: &Path,\n    distro: Option<&str>,\n    channel: &str,\n    version: &str,\n) -> Result<String> {\n    // TODO: Remove this development override once WSL canonical-path handling is released.\n    if let Some(helper) = std::env::var_os(\"ZED_WSL_SANDBOX_HELPER\") {\n        let helper = helper\n            .into_string()\n            .map_err(|_| anyhow::anyhow!(\"ZED_WSL_SANDBOX_HELPER is not valid UTF-8\"))?;\n        ensure!(\n            helper.starts_with('/'),\n            \"ZED_WSL_SANDBOX_HELPER must be an absolute path inside WSL\"\n        );\n        return Ok(helper);\n    }\n\n    type HelperCache = HashMap<(Option<String>, String, String), String>;\n    static CACHE: OnceLock<Mutex<HelperCache>> = OnceLock::new();\n    let cache = CACHE.get_or_init(|| Mutex::new(HashMap::new()));\n\n    let key = (\n        distro.map(str::to_string),\n        channel.to_string(),\n        version.to_string(),\n    );\n    if let Some(path) = cache\n        .lock()","sourceCodeStart":850,"sourceCodeEnd":886,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/sandbox/src/windows_wsl.rs#L850-L886","documentation":"Raised in ensure_wsl_zed_helper when the ZED_WSL_SANDBOX_HELPER environment variable (used to override the helper path) contains non-UTF-8 bytes, so it cannot be treated as a path. The override is rejected and helper provisioning does not proceed.","triggerScenarios":"Thrown at crates/sandbox/src/windows_wsl.rs:868 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set ZED_WSL_SANDBOX_HELPER to a valid UTF-8 path or unset it"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}