zed-industries/zed · error

Windows sandboxing via WSL can only use an existing director

Error message

Windows sandboxing via WSL can only use an existing directory as cwd: {}

What it means

Raised in directory_to_wsl when the requested cwd for a Windows-via-WSL sandboxed command is not an existing directory. The WSL sandbox binds the cwd into the distro; it cannot create or map a nonexistent directory, so wrapping fails with the offending path shown.

Source

Thrown at crates/sandbox/src/windows_wsl.rs:1419

        "PROCESSOR_IDENTIFIER",
        "PROCESSOR_LEVEL",
        "PROCESSOR_REVISION",
    ];
    !BLOCKED
        .iter()
        .any(|blocked| name.eq_ignore_ascii_case(blocked))
}

fn push_bind(args: &mut Vec<String>, flag: &str, source: &str, destination: &str) {
    args.extend([
        flag.to_string(),
        source.to_string(),
        destination.to_string(),
    ]);
}

fn directory_to_wsl(path: &Path) -> Result<PathMapping> {
    ensure!(
        path.is_dir(),
        "Windows sandboxing via WSL can only use an existing directory as cwd: {}",
        path.display()
    );
    map_path_to_wsl(path)
}

fn path_to_wsl(path: &Path) -> Result<PathMapping> {
    let path_string = path.to_string_lossy();
    if let Ok(path) = parse_wsl_absolute_path(&path_string) {
        return Ok(PathMapping::Wsl(path));
    }

    ensure!(
        path.is_dir() || path.is_file(),
        "Windows sandboxing via WSL can only grant existing files or directories: {}",
        path.display()
    );

View on GitHub (pinned to f4178619ac)

Solutions

  1. Create the directory (or open an existing project directory) before sandboxing
  2. Check the path resolves to a directory inside the chosen WSL distro
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/sandbox/src/windows_wsl.rs:1419 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/f8db1cef8515b743. Report an issue: GitHub.