{"record":{"id":"c3dbc371d432230e","repo":"nikivdev/code","slug":"deploy-helper-build-failed","errorCode":null,"errorMessage":"deploy helper build failed","messagePattern":"deploy helper build failed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/deploy.rs","lineNumber":645,"sourceCode":"\n    let repo = deploy_helper_repo();\n    if !repo.exists() {\n        println!(\n            \"Deploy helper not found. Set {} or install it to continue.\",\n            DEPLOY_HELPER_ENV_BIN\n        );\n        return Ok(None);\n    }\n\n    println!(\"Installing deploy helper...\");\n    let status = Command::new(\"cargo\")\n        .args([\"build\", \"--release\"])\n        .current_dir(&repo)\n        .status()\n        .context(\"failed to build deploy helper\")?;\n\n    if !status.success() {\n        bail!(\"deploy helper build failed\");\n    }\n\n    let bin_path = repo.join(\"target/release\").join(DEPLOY_HELPER_BIN);\n    let install_dir = dirs::home_dir()\n        .unwrap_or_else(|| PathBuf::from(\".\"))\n        .join(\".local/bin\");\n    fs::create_dir_all(&install_dir)\n        .with_context(|| format!(\"failed to create {}\", install_dir.display()))?;\n    let install_path = install_dir.join(DEPLOY_HELPER_BIN);\n    fs::copy(&bin_path, &install_path)\n        .with_context(|| format!(\"failed to copy {}\", install_path.display()))?;\n    #[cfg(unix)]\n    {\n        use std::os::unix::fs::PermissionsExt;\n        let mut perms = fs::metadata(&install_path)?.permissions();\n        perms.set_mode(0o755);\n        fs::set_permissions(&install_path, perms)?;\n    }","sourceCodeStart":627,"sourceCodeEnd":663,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/deploy.rs#L627-L663","documentation":"ensure_deploy_helper builds the bundled deploy-helper crate (`cargo build --release` in the helper repo) and installs the resulting binary; if the cargo build exits non-zero it bails with `deploy helper build failed`. The CLI needs this helper binary on disk before it can perform deploys.","triggerScenarios":"First run or post-update rebuild of the deploy helper when `cargo build --release` fails: missing Rust toolchain, compile errors, missing dependencies, no network for crates.io downloads, or insufficient disk space/permissions in the target dir.","commonSituations":"Machine without rustup/cargo installed; offline CI runner that can't fetch crates; Rust edition/toolchain too old for the helper's MSRV; the helper repo checked out at a broken commit.","solutions":["Run `cargo build --release` in the helper repo manually to see the real compiler error (the bail message hides it).","Install/update the Rust toolchain (`rustup update stable`) to meet the helper's MSRV.","Ensure network access to crates.io or vendor dependencies (`cargo vendor`) on offline machines.","Free disk space / fix permissions on the target directory if cargo fails on I/O.","Update the CLI so the vendored helper repo is at a working commit."],"exampleFix":"// before: compiler error hidden\nif !status.success() { bail!(\"deploy helper build failed\"); }\n// after: surface output for debugging\nif !status.success() { anyhow::bail!(\"deploy helper build failed: run `cargo build --release` in {} to see why\", repo.display()); }","handlingStrategy":"try-catch","validationCode":"// Shell: verify toolchain before triggering the helper build\ncargo --version >/dev/null 2>&1 || { echo \"cargo missing — install rustup first\"; exit 1; }\nrustc --version | grep -qE '1\\.(7[0-9]|[89][0-9]|[0-9]{3})' || echo \"warning: old toolchain may not meet helper MSRV\"","typeGuard":null,"tryCatchPattern":"match ensure_deploy_helper() {\n    Ok(()) => proceed_with_deploy(),\n    Err(e) if e.to_string().contains(\"deploy helper build failed\") => {\n        eprintln!(\"Helper build failed — run `cargo build --release` in the helper repo for the compiler error; check rustup update and network access.\");\n        std::process::exit(1);\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Install rustup and keep the stable toolchain updated before first deploy.","Pre-build the helper in setup/CI images so deploys don't compile on demand.","Ensure crates.io is reachable or vendor dependencies for offline environments.","Keep enough free disk space for a release build in ~/.local and the helper target dir."],"tags":["build","cargo","rust-toolchain"],"backgroundTag":"build-failed","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}