{"record":{"id":"06a0ca085504d3df","repo":"zeroclaw-labs/zeroclaw","slug":"built-binary-not-found-at","errorCode":null,"errorMessage":"Built binary not found at {}","messagePattern":"Built binary not found at (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/zeroclaw-hardware/src/peripherals/nucleo_flash.rs","lineNumber":60,"sourceCode":"    let build = Command::new(\"cargo\")\n        .args([\"build\", \"--release\", \"--target\", TARGET])\n        .current_dir(&firmware_dir)\n        .output()\n        .context(\"cargo build failed\")?;\n\n    if !build.status.success() {\n        let stderr = String::from_utf8_lossy(&build.stderr);\n        anyhow::bail!(\"Build failed:\\n{}\", stderr);\n    }\n\n    let elf_path = firmware_dir\n        .join(\"target\")\n        .join(TARGET)\n        .join(\"release\")\n        .join(\"nucleo\");\n\n    if !elf_path.exists() {\n        anyhow::bail!(\n            \"Built binary not found at {}\",\n            elf_path.display().to_string()\n        );\n    }\n\n    println!(\"Flashing to Nucleo-F401RE (connect via USB)...\");\n    let flash = Command::new(\"probe-rs\")\n        .args([\n            \"run\",\n            \"--chip\",\n            CHIP,\n            elf_path.to_str().context(\"ELF path is not valid UTF-8\")?,\n        ])\n        .output()\n        .context(\"probe-rs run failed\")?;\n\n    if !flash.status.success() {\n        let stderr = String::from_utf8_lossy(&flash.stderr);","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/zeroclaw-labs/zeroclaw/blob/88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc/crates/zeroclaw-hardware/src/peripherals/nucleo_flash.rs#L42-L78","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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\")"],"exampleFix":"# before\nexport CARGO_TARGET_DIR=/shared/target\n# flash reports: Built binary not found at .../firmware/nucleo/target/thumbv7em-none-eabihf/release/nucleo\n\n# after\nunset CARGO_TARGET_DIR\n# rerun the Nucleo flash","handlingStrategy":"validation","validationCode":"if std::env::var_os(\"CARGO_TARGET_DIR\").is_some() {\n    anyhow::bail!(\"CARGO_TARGET_DIR set: artifacts will not land where the flasher looks\");\n}\nflash_nucleo_firmware()?;","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["cargo","target-dir","build-artifact","nucleo"],"backgroundTag":"build-artifact-not-found","analyzedSha":"88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc","analyzedAt":"2026-08-23T01:07:41.857Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}