{"record":{"id":"5d1630804f96e306","repo":"zeroclaw-labs/zeroclaw","slug":"smoke-test-updated-binary-returned-non-zero-exit","errorCode":null,"errorMessage":"smoke test: updated binary returned non-zero exit code","messagePattern":"smoke test: updated binary returned non-zero exit code","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/commands/update.rs","lineNumber":984,"sourceCode":"            Err(_) => {\n                // Can't tell what it is; try file first, then dir.\n                if tokio::fs::remove_file(&path).await.is_err() {\n                    let _ = tokio::fs::remove_dir_all(&path).await;\n                }\n            }\n        }\n    }\n}\n\nasync fn smoke_test(binary: &Path) -> Result<()> {\n    let output = tokio::process::Command::new(binary)\n        .arg(\"--version\")\n        .output()\n        .await\n        .context(\"smoke test: cannot execute updated binary\")?;\n\n    if !output.status.success() {\n        bail!(\"smoke test: updated binary returned non-zero exit code\");\n    }\n\n    Ok(())\n}\n\n/// Install every artifact in `staging` other than the main binary onto the\n/// running install: the `web/dist` dashboard bundle and any other top-level\n/// files (e.g. the `zerocode` companion).\n///\n/// Best-effort by design — the `zeroclaw` binary has already been swapped and\n/// smoke-tested. A failure here (e.g. an unwritable data directory) is logged\n/// and swallowed rather than failing or rolling back an otherwise-good update.\nasync fn install_companion_artifacts(\n    staging: &Path,\n    current_exe: &Path,\n    host_candidates: &[PathBuf],\n) {\n    // 1. Dashboard bundle, if present: swap the whole `web/dist` directory so a","sourceCodeStart":966,"sourceCodeEnd":1002,"githubUrl":"https://github.com/zeroclaw-labs/zeroclaw/blob/88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc/src/commands/update.rs#L966-L1002","documentation":"After swapping the new binary into place, the updater smoke-tests it by running `<installed-binary> --version`. A non-zero exit aborts with this error; the updater has rollback machinery (rollback_binary restoring the backup, at least on Windows) and skips companion-artifact installation on failure. This check catches an update that is broken only in its final installed context.","triggerScenarios":"`zeroclaw update` where the new binary validates in staging but fails once installed: missing execute permission after the swap, antivirus quarantining the new file (common on Windows), a partially written file, or runtime differences specific to the install path.","commonSituations":"Windows Defender/AV locking or quarantining freshly replaced executables; permission bits lost during the swap; disk errors during final write; the smoke-test child process killed by policy software.","solutions":["Run `zeroclaw --version` manually to see whether the installed binary is actually broken or the failure was transient.","Re-run `zeroclaw update`; a clean retry rewrites the binary and re-runs the smoke test.","On Windows, check antivirus quarantine/history and add an exclusion for the zeroclaw install directory.","If the binary is left broken, reinstall the previous or current release manually from the release page."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"# after a failed automated update, verify the install before proceeding\nzeroclaw --version || {\n  echo 'update smoke test failed; binary broken' >&2\n  # reinstall last-known-good from the release page\n  exit 1\n}","typeGuard":null,"tryCatchPattern":"match run_update().await {\n    Err(e) if e.to_string().contains(\"smoke test\") => {\n        // updater attempts rollback; verify with `zeroclaw --version`, then\n        // either re-run the update or reinstall the previous release manually\n    }\n    other => other,\n}","preventionTips":["On Windows, add an antivirus exclusion for the zeroclaw install directory before updating.","Always verify with `zeroclaw --version` after unattended updates before declaring success.","Keep a copy of the last-known-good binary (or its release URL) so rollback is one download away."],"tags":["update","smoke-test","post-install","rollback"],"backgroundTag":"post-install-smoke-test-failure","analyzedSha":"88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc","analyzedAt":"2026-08-23T01:07:41.857Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}