zeroclaw-labs/zeroclaw · error · anyhow::Error
Update failed during swap: {e}
Error message
Update failed during swap: {e} What it means
Error "Update failed during swap: {e}" thrown in zeroclaw-labs/zeroclaw.
Source
Thrown at src/commands/update.rs:283
);
if let Err(e) = swap_binary(&main_binary, ¤t_exe).await {
// Rollback
::zeroclaw_log::record!(
WARN,
::zeroclaw_log::Event::new(module_path!(), ::zeroclaw_log::Action::Note)
.with_outcome(::zeroclaw_log::EventOutcome::Unknown)
.with_attrs(::serde_json::json!({"error": format!("{}", e)})),
"Swap failed, rolling back"
);
if let Err(rollback_err) = rollback_binary(&backup_path, ¤t_exe).await {
eprintln!("CRITICAL: Rollback also failed: {rollback_err}"); // i18n-exempt: emergency operator recovery diagnostic, must be unambiguous
eprintln!(
"Manual recovery: cp {} {}",
backup_path.display(),
current_exe.display()
);
}
bail!("Update failed during swap: {e}");
}
// Phase 6: Smoke test
::zeroclaw_log::record!(
INFO,
::zeroclaw_log::Event::new(module_path!(), ::zeroclaw_log::Action::Note),
"Phase 6/6: Smoke test..."
);
match smoke_test(¤t_exe).await {
Ok(()) => {
// Cleanup backup on success
let _ = tokio::fs::remove_file(&backup_path).await;
// Install everything else the archive shipped (the `zerocode`
// companion, the `web/dist` dashboard bundle, …). Best-effort:
// the validated main binary is already in place and must not be
// rolled back if these fail.
install_companion_artifacts(&staging, ¤t_exe, &host_dashboard_candidates()).await;
println!("{}", update_success_message(&update_info.latest_version));View on GitHub (pinned to 88bb9c8533)
Solutions
- Inspect the swap error (permissions, busy binary, disk space), fix it, and re-run the update.
- Re-run `zeroclaw update`; the previous binary is preserved so a failed swap can be retried safely.
When it happens
Trigger: Thrown at src/commands/update.rs:283 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/3950e34449b5abab.
Report an issue: GitHub.