zed-industries/zed · error

cannot sandbox a command whose paths mix WSL distros `{}` an

Error message

cannot sandbox a command whose paths mix WSL distros `{}` and `{}`

What it means

The command's cwd and writable paths resolve to different WSL distros; a single bwrap invocation cannot bind paths across distros. This is a bad request (model/project layout), not an environment problem.

Source

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

    }

    Ok((cwd, writable_paths, resolved.flatten().collect()))
}

fn select_distro<'a>(
    cwd: Option<&PathMapping>,
    paths: impl IntoIterator<Item = &'a PathMapping>,
) -> Result<Option<String>> {
    let mut distro = cwd.and_then(|mapping| mapping.distro().map(str::to_string));
    for mapping in paths {
        let Some(path_distro) = mapping.distro() else {
            continue;
        };
        match distro.as_deref() {
            // A bad request, not an environment problem: the model (or
            // project layout) asked for paths spanning two distros, which a
            // single bwrap invocation can't serve.
            Some(distro) => ensure!(
                distro == path_distro,
                "cannot sandbox a command whose paths mix WSL distros `{}` and `{}`",
                distro,
                path_distro
            ),
            None => distro = Some(path_distro.to_string()),
        }
    }
    Ok(distro)
}

/// What [`probe_environment`] learned about a WSL distro.
#[derive(Clone, Debug, Eq, PartialEq)]
struct EnvironmentProbe {
    /// Whether the WSL interop socket directory (`/run/WSL`) exists and so
    /// must (and can) be masked — see [`build_bwrap_args`].
    mask_interop_dir: bool,
    /// Absolute path of the `bwrap` binary the smoke test validated. The real

View on GitHub (pinned to f4178619ac)

Solutions

  1. Ensure the cwd and all granted paths live in the same WSL distro
  2. Explicitly select one distro and convert the offending paths before sandboxing
Defensive patterns

Strategy: validation

When it happens

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