{"record":{"id":"b32ffa58db0ada6a","repo":"astrid-runtime/astrid","slug":"cargo-is-not-installed-or-not-in-path-rust-comp","errorCode":null,"errorMessage":"`cargo` is not installed or not in PATH. Rust compilation failed.","messagePattern":"`cargo` is not installed or not in PATH\\. Rust compilation failed\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-build/src/rust.rs","lineNumber":106,"sourceCode":"        Some(&wasm_path),\n        dir,\n        &asset_refs,\n        wit_staging.as_deref(),\n    )?;\n    crate::artifact::sign_archive_with_runtime_key(&out_file)?;\n\n    info!(\"Successfully built Rust capsule: {}\", out_file.display());\n    Ok(())\n}\n\n/// Verify that `cargo` is installed and available on PATH.\nfn verify_cargo_available() -> Result<()> {\n    if std::process::Command::new(\"cargo\")\n        .arg(\"--version\")\n        .output()\n        .is_err()\n    {\n        bail!(\"`cargo` is not installed or not in PATH. Rust compilation failed.\");\n    }\n    Ok(())\n}\n\n/// Resolve package metadata for the crate in `dir`.\nfn resolve_package_metadata(\n    dir: &Path,\n) -> Result<(cargo_metadata::Metadata, String, String, String, PackageId)> {\n    // Resolve the full dependency graph (not no_deps) so we can locate\n    // the astrid-sdk source directory for WIT file bundling.\n    let meta = cargo_metadata::MetadataCommand::new()\n        .current_dir(dir)\n        .exec()\n        .context(\"Failed to parse Cargo metadata\")?;\n\n    let package = meta\n        .packages\n        .iter()","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-build/src/rust.rs#L88-L124","documentation":"Environment prerequisite check in verify_cargo_available: spawning `cargo --version` failed, so the Rust toolchain is either not installed or not reachable via PATH. Raised before any compilation begins so the user gets a clear toolchain error instead of a cryptic cargo-spawn failure mid-build. Called by build.","triggerScenarios":"Thrown at crates/astrid-build/src/rust.rs:106 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Install Rust via rustup (https://rustup.rs)","Ensure `cargo` is on PATH (`which cargo`)","If using an isolated environment, install the Rust toolchain there too"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}