zed-industries/zed · error

Failed to run 'which' to find the binary '{binary_name}': {e

Error message

Failed to run 'which' to find the binary '{binary_name}': {err}

What it means

In transport.rs which: the which::which lookup failed with an error other than CannotFindBinaryPath (e.g. permission or internal error), so the helper cannot report 'not found' and instead propagates the failure while searching for a binary.

Source

Thrown at crates/remote/src/transport.rs:451

    };

    Ok(Some(path))
}

#[cfg(any(debug_assertions, feature = "build-remote-server-binary"))]
async fn which(
    binary_name: impl AsRef<str>,
    cx: &mut AsyncApp,
) -> Result<Option<std::path::PathBuf>> {
    let binary_name = binary_name.as_ref().to_string();
    let binary_name_cloned = binary_name.clone();
    let res = cx
        .background_spawn(async move { which::which(binary_name_cloned) })
        .await;
    match res {
        Ok(path) => Ok(Some(path)),
        Err(which::Error::CannotFindBinaryPath) => Ok(None),
        Err(err) => Err(anyhow::anyhow!(
            "Failed to run 'which' to find the binary '{binary_name}': {err}"
        )),
    }
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_parse_platform() {
        let result = parse_platform("Linux x86_64\n").unwrap();
        assert_eq!(result.os, RemoteOs::Linux);
        assert_eq!(result.arch, RemoteArch::X86_64);

        let result = parse_platform("Darwin arm64\n").unwrap();
        assert_eq!(result.os, RemoteOs::MacOs);
        assert_eq!(result.arch, RemoteArch::Aarch64);

View on GitHub (pinned to f4178619ac)

Solutions

  1. Check that the zed/remote-server binary is on PATH or prebuilt
  2. Inspect the underlying which::Error for the cause
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at crates/remote/src/transport.rs:451 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/6d9231e90637b255. Report an issue: GitHub.