zeroclaw-labs/zeroclaw · error
Built binary not found at {}
Error message
Built binary not found at {} What it means
After a successful cargo build, flash_nucleo_firmware expects the ELF at firmware/nucleo/target/thumbv7em-none-eabihf/release/nucleo. This bail fires when cargo reported success but the artifact is not at that hardcoded path — build output was redirected elsewhere or the binary has a different name.
Source
Thrown at crates/zeroclaw-hardware/src/peripherals/nucleo_flash.rs:60
let build = Command::new("cargo")
.args(["build", "--release", "--target", TARGET])
.current_dir(&firmware_dir)
.output()
.context("cargo build failed")?;
if !build.status.success() {
let stderr = String::from_utf8_lossy(&build.stderr);
anyhow::bail!("Build failed:\n{}", stderr);
}
let elf_path = firmware_dir
.join("target")
.join(TARGET)
.join("release")
.join("nucleo");
if !elf_path.exists() {
anyhow::bail!(
"Built binary not found at {}",
elf_path.display().to_string()
);
}
println!("Flashing to Nucleo-F401RE (connect via USB)...");
let flash = Command::new("probe-rs")
.args([
"run",
"--chip",
CHIP,
elf_path.to_str().context("ELF path is not valid UTF-8")?,
])
.output()
.context("probe-rs run failed")?;
if !flash.status.success() {
let stderr = String::from_utf8_lossy(&flash.stderr);View on GitHub (pinned to 88bb9c8533)
Solutions
- Unset CARGO_TARGET_DIR and remove/adjust build.target-dir overrides, then rebuild
- Locate the real artifact: `find firmware/nucleo -name nucleo -type f` and align the target dir with the expected path
- Ensure firmware/nucleo produces a binary named `nucleo` (package name or [[bin]] name = "nucleo")
Example fix
# before export CARGO_TARGET_DIR=/shared/target # flash reports: Built binary not found at .../firmware/nucleo/target/thumbv7em-none-eabihf/release/nucleo # after unset CARGO_TARGET_DIR # rerun the Nucleo flash
Defensive patterns
Strategy: validation
Validate before calling
if std::env::var_os("CARGO_TARGET_DIR").is_some() {
anyhow::bail!("CARGO_TARGET_DIR set: artifacts will not land where the flasher looks");
}
flash_nucleo_firmware()?; Prevention
- Unset CARGO_TARGET_DIR and build.target-dir overrides before flashing
- If a shared target dir is required, symlink or copy the ELF back to firmware/nucleo/target/thumbv7em-none-eabihf/release/nucleo
- Keep the firmware binary named `nucleo` when refactoring firmware/nucleo
When it happens
Trigger: CARGO_TARGET_DIR is set (or build.target-dir is set in .cargo/config.toml) so cargo writes artifacts to another location; the firmware package's binary is renamed via [[bin]] so no file named `nucleo` is produced.
Common situations: Shared CARGO_TARGET_DIR in CI or shell profiles; repo-wide .cargo/config.toml redirecting output for caching; refactors of firmware/nucleo that change the package or bin name.
Related errors
- Build failed:\n{}
- probe-rs not found. Install it: cargo install probe-rs-too
- Nucleo firmware not found at {}. Run from zeroclaw repo root
AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23).
Data as JSON: /api/errors/06a0ca085504d3df.
Report an issue: GitHub.