zed-industries/zed · error · anyhow::Error

Failed to convert path to WSL path: {:?}

Error message

Failed to convert path to WSL path: {:?}

What it means

Raised in the WSL kernel constructor when `wsl -d <distro> wslpath -u <path>` exits non-zero. The wslpath output status (shown via {:?}) is the fault; the kernel's Windows-side connection file path could not be translated into a WSL-visible path, so the kernel command line cannot be built.

Source

Thrown at crates/repl/src/kernels/wsl_kernel.rs:133

            // yeah we can't assume this is available on WSL.
            // running `wsl -d <distro> wslpath -u <windows_path>`
            let mut wslpath_cmd = util::command::new_command("wsl");

            // On Windows, passing paths with backslashes to wsl.exe can sometimes cause
            // escaping issues or be misinterpreted. Converting to forward slashes is safer
            // and often accepted by wslpath.
            let connection_path_str = connection_path.to_string_lossy().replace('\\', "/");

            wslpath_cmd
                .arg("-d")
                .arg(&kernel_specification.distro)
                .arg("wslpath")
                .arg("-u")
                .arg(&connection_path_str);

            let output = wslpath_cmd.output().await?;
            if !output.status.success() {
                anyhow::bail!("Failed to convert path to WSL path: {:?}", output);
            }
            let wsl_connection_path = String::from_utf8_lossy(&output.stdout).trim().to_string();

            // Construct the kernel command
            // The kernel spec argv might have absolute paths valid INSIDE WSL.
            // We need to run inside WSL.
            // `wsl -d <distro> --exec <argv0> <argv1> ...`
            // But we need to replace {connection_file} with wsl_connection_path.

            anyhow::ensure!(
                !kernel_specification.kernelspec.argv.is_empty(),
                "Empty argv in kernelspec {}",
                kernel_specification.name
            );

            let working_directory_str = working_directory.to_string_lossy().replace('\\', "/");

            let wsl_working_directory = if working_directory_str.starts_with('/') {

View on GitHub (pinned to f4178619ac)

Solutions

  1. Verify `wsl` and `wslpath` work inside the target distribution (`wsl -d <distro> wslpath -u <path>`)
  2. Check the distro name passed with -d matches an installed distribution
  3. Ensure the Windows path exists before conversion
  4. Fall back to a manual path if the connection file must be pre-created
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at crates/repl/src/kernels/wsl_kernel.rs:133 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20). Data as JSON: /api/errors/57a5f3afe64de600. Report an issue: GitHub.