zeroclaw-labs/zeroclaw · error
UF2 at {} does not look like a valid UF2 file (magic mismatc
Error message
UF2 at {} does not look like a valid UF2 file (magic mismatch). Download from https://micropython.org/download/RPI_PICO/ and delete the existing file so ZeroClaw can re-extract it. What it means
Error "UF2 at {} does not look like a valid UF2 file (magic mismatch). Download from https://micropython.org/download/RPI_PICO/ and delete the existing file so ZeroClaw can re-extract it." thrown in zeroclaw-labs/zeroclaw.
Source
Thrown at crates/zeroclaw-hardware/src/uf2.rs:103
// ── Flashing ──────────────────────────────────────────────────────────────────
pub async fn flash_uf2(mount_point: &Path, firmware_dir: &Path) -> Result<()> {
let uf2_src = firmware_dir.join("zeroclaw-pico.uf2");
let uf2_dst = mount_point.join("firmware.uf2");
let src_str = uf2_src.to_string_lossy().into_owned();
let dst_str = uf2_dst.to_string_lossy().into_owned();
::zeroclaw_log::record!(
INFO,
::zeroclaw_log::Event::new(module_path!(), ::zeroclaw_log::Action::Note)
.with_attrs(::serde_json::json!({"src": src_str, "dst": dst_str})),
"flashing UF2"
);
// Validate UF2 magic before any copy attempt — prevents flashing a stub.
let data = std::fs::read(&uf2_src)?;
if data.len() < 8 || data[..4] != UF2_MAGIC1 {
bail!(
"UF2 at {} does not look like a valid UF2 file (magic mismatch). \
Download from https://micropython.org/download/RPI_PICO/ and delete \
the existing file so ZeroClaw can re-extract it.",
uf2_src.display()
);
}
// ── Attempt 1: std::fs::copy (works on Linux, sometimes blocked on macOS) ─
{
let src = uf2_src.clone();
let dst = uf2_dst.clone();
let result = tokio::task::spawn_blocking(move || std::fs::copy(&src, &dst))
.await
.map_err(|e| {
::zeroclaw_log::record!(
ERROR,
::zeroclaw_log::Event::new(module_path!(), ::zeroclaw_log::Action::Fail)
.with_outcome(::zeroclaw_log::EventOutcome::Failure)View on GitHub (pinned to 88bb9c8533)
Solutions
- Download a valid UF2 from https://micropython.org/download/RPI_PICO/ and delete the existing corrupt file so ZeroClaw can re-extract it.
When it happens
Trigger: Thrown at crates/zeroclaw-hardware/src/uf2.rs:103 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23).
Data as JSON: /api/errors/3fa4848a30ce67f9.
Report an issue: GitHub.