{"record":{"id":"6d9231e90637b255","repo":"zed-industries/zed","slug":"failed-to-run-which-to-find-the-binary-binary","errorCode":null,"errorMessage":"Failed to run 'which' to find the binary '{binary_name}': {err}","messagePattern":"Failed to run 'which' to find the binary '(.+?)': (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/remote/src/transport.rs","lineNumber":451,"sourceCode":"    };\n\n    Ok(Some(path))\n}\n\n#[cfg(any(debug_assertions, feature = \"build-remote-server-binary\"))]\nasync fn which(\n    binary_name: impl AsRef<str>,\n    cx: &mut AsyncApp,\n) -> Result<Option<std::path::PathBuf>> {\n    let binary_name = binary_name.as_ref().to_string();\n    let binary_name_cloned = binary_name.clone();\n    let res = cx\n        .background_spawn(async move { which::which(binary_name_cloned) })\n        .await;\n    match res {\n        Ok(path) => Ok(Some(path)),\n        Err(which::Error::CannotFindBinaryPath) => Ok(None),\n        Err(err) => Err(anyhow::anyhow!(\n            \"Failed to run 'which' to find the binary '{binary_name}': {err}\"\n        )),\n    }\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n\n    #[test]\n    fn test_parse_platform() {\n        let result = parse_platform(\"Linux x86_64\\n\").unwrap();\n        assert_eq!(result.os, RemoteOs::Linux);\n        assert_eq!(result.arch, RemoteArch::X86_64);\n\n        let result = parse_platform(\"Darwin arm64\\n\").unwrap();\n        assert_eq!(result.os, RemoteOs::MacOs);\n        assert_eq!(result.arch, RemoteArch::Aarch64);","sourceCodeStart":433,"sourceCodeEnd":469,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/remote/src/transport.rs#L433-L469","documentation":"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.","triggerScenarios":"Thrown at crates/remote/src/transport.rs:451 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check that the zed/remote-server binary is on PATH or prebuilt","Inspect the underlying which::Error for the cause"],"exampleFix":null,"handlingStrategy":"try-catch","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"}