nikivdev/code · error

deploy helper build failed

Error message

deploy helper build failed

What it means

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.

Source

Thrown at src/deploy.rs:645

    let repo = deploy_helper_repo();
    if !repo.exists() {
        println!(
            "Deploy helper not found. Set {} or install it to continue.",
            DEPLOY_HELPER_ENV_BIN
        );
        return Ok(None);
    }

    println!("Installing deploy helper...");
    let status = Command::new("cargo")
        .args(["build", "--release"])
        .current_dir(&repo)
        .status()
        .context("failed to build deploy helper")?;

    if !status.success() {
        bail!("deploy helper build failed");
    }

    let bin_path = repo.join("target/release").join(DEPLOY_HELPER_BIN);
    let install_dir = dirs::home_dir()
        .unwrap_or_else(|| PathBuf::from("."))
        .join(".local/bin");
    fs::create_dir_all(&install_dir)
        .with_context(|| format!("failed to create {}", install_dir.display()))?;
    let install_path = install_dir.join(DEPLOY_HELPER_BIN);
    fs::copy(&bin_path, &install_path)
        .with_context(|| format!("failed to copy {}", install_path.display()))?;
    #[cfg(unix)]
    {
        use std::os::unix::fs::PermissionsExt;
        let mut perms = fs::metadata(&install_path)?.permissions();
        perms.set_mode(0o755);
        fs::set_permissions(&install_path, perms)?;
    }

View on GitHub (pinned to a747e741ae)

Solutions

  1. Run `cargo build --release` in the helper repo manually to see the real compiler error (the bail message hides it).
  2. Install/update the Rust toolchain (`rustup update stable`) to meet the helper's MSRV.
  3. Ensure network access to crates.io or vendor dependencies (`cargo vendor`) on offline machines.
  4. Free disk space / fix permissions on the target directory if cargo fails on I/O.
  5. Update the CLI so the vendored helper repo is at a working commit.

Example fix

// before: compiler error hidden
if !status.success() { bail!("deploy helper build failed"); }
// after: surface output for debugging
if !status.success() { anyhow::bail!("deploy helper build failed: run `cargo build --release` in {} to see why", repo.display()); }
Defensive patterns

Strategy: try-catch

Validate before calling

// Shell: verify toolchain before triggering the helper build
cargo --version >/dev/null 2>&1 || { echo "cargo missing — install rustup first"; exit 1; }
rustc --version | grep -qE '1\.(7[0-9]|[89][0-9]|[0-9]{3})' || echo "warning: old toolchain may not meet helper MSRV"

Try / catch

match ensure_deploy_helper() {
    Ok(()) => proceed_with_deploy(),
    Err(e) if e.to_string().contains("deploy helper build failed") => {
        eprintln!("Helper build failed — run `cargo build --release` in the helper repo for the compiler error; check rustup update and network access.");
        std::process::exit(1);
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01). Data as JSON: /api/errors/c3dbc371d432230e. Report an issue: GitHub.