{"record":{"id":"87e9cdfc58a3ac0e","repo":"zeroclaw-labs/zeroclaw","slug":"nucleo-firmware-not-found-at-run-from-zeroclaw","errorCode":null,"errorMessage":"Nucleo firmware not found at {}. Run from zeroclaw repo root.","messagePattern":"Nucleo firmware not found at (.+?)\\. Run from zeroclaw repo root\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/zeroclaw-hardware/src/peripherals/nucleo_flash.rs","lineNumber":35,"sourceCode":"        .map(|o| o.status.success())\n        .unwrap_or(false)\n}\n\n/// Flash ZeroClaw Nucleo firmware. Builds from firmware/nucleo.\npub fn flash_nucleo_firmware() -> Result<()> {\n    if !probe_rs_available() {\n        anyhow::bail!(\n            \"probe-rs not found. Install it:\\n  cargo install probe-rs-tools --locked\\n\\n\\\n             Or: curl -LsSf https://github.com/probe-rs/probe-rs/releases/latest/download/probe-rs-tools-installer.sh | sh\\n\\n\\\n             Connect Nucleo via USB (ST-Link). Then run this command again.\"\n        );\n    }\n\n    // CARGO_MANIFEST_DIR = repo root (zeroclaw's Cargo.toml)\n    let repo_root = PathBuf::from(env!(\"CARGO_MANIFEST_DIR\"));\n    let firmware_dir = repo_root.join(\"firmware\").join(\"nucleo\");\n    if !firmware_dir.join(\"Cargo.toml\").exists() {\n        anyhow::bail!(\n            \"Nucleo firmware not found at {}. Run from zeroclaw repo root.\",\n            firmware_dir.display()\n        );\n    }\n\n    println!(\"Building ZeroClaw Nucleo firmware...\");\n    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","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/zeroclaw-labs/zeroclaw/blob/88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc/crates/zeroclaw-hardware/src/peripherals/nucleo_flash.rs#L17-L53","documentation":"flash_nucleo_firmware locates the firmware at <CARGO_MANIFEST_DIR>/firmware/nucleo, where CARGO_MANIFEST_DIR is baked in at compile time from the zeroclaw-hardware crate. This bail fires when that directory has no Cargo.toml. Despite the message saying 'Run from zeroclaw repo root', the path does not depend on the current working directory — changing directories cannot fix it.","triggerScenarios":"The zeroclaw binary was built from a source tree lacking firmware/nucleo (sparse checkout, packaged crate build), so the compiled-in absolute path points at a directory that does not exist on this machine.","commonSituations":"Using a prebuilt/released zeroclaw binary and expecting it to flash firmware; partial clones that exclude the firmware directory; moving or deleting the repo after building.","solutions":["Use a full git clone of the zeroclaw repo so firmware/nucleo sits next to crates/zeroclaw-hardware, and run the flash from that checkout","Verify the path printed in the error contains Cargo.toml; if not, restore the firmware/nucleo directory","Rebuild zeroclaw inside the full checkout so CARGO_MANIFEST_DIR resolves to it"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"let firmware = std::path::Path::new(env!(\"CARGO_MANIFEST_DIR\"))\n    .join(\"firmware\").join(\"nucleo\");\nif !firmware.join(\"Cargo.toml\").exists() {\n    anyhow::bail!(\"full zeroclaw checkout required: {} missing\", firmware.display());\n}\nflash_nucleo_firmware()?;","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run board flashing only from a full source checkout, never from a copied binary","Remember the firmware path is compile-time (CARGO_MANIFEST_DIR): moving the repo after build invalidates it","Document that flashing commands require the repo, not just the runtime"],"tags":["nucleo","compile-time-path","cargo-manifest-dir","missing-directory"],"backgroundTag":"missing-resource-path","analyzedSha":"88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc","analyzedAt":"2026-08-23T01:07:41.857Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}