{"record":{"id":"9c58a0942daf71b9","repo":"Hmbown/CodeWhale","slug":"the-running-executable-path-changed-during-the-update-no","errorCode":null,"errorMessage":"The running executable path changed during the update; no further files were replaced. Run the intended executable again by its full path.","messagePattern":"The running executable path changed during the update; no further files were replaced\\. Run the intended executable again by its full path\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/cli/src/update.rs","lineNumber":556,"sourceCode":"    let minor = ((device & 0xff) | ((device >> 12) & 0xfff00)) as u32;\n    (major, minor)\n}\n\nfn validate_primary_update_identity(identity: &UpdateExecutableIdentity) -> Result<()> {\n    #[cfg(target_os = \"android\")]\n    {\n        let fresh = android_loaded_executable_proof()?;\n        if fresh != identity.android_proof {\n            bail!(\n                \"Android loaded-image proof changed from {:?} to {:?}; refusing to replace the update target\",\n                identity.android_proof,\n                fresh\n            );\n        }\n    }\n    let bytes = std::fs::read(&identity.path).context(\"failed to recheck updater binary\")?;\n    if sha256_hex(&bytes) != identity.file_hash {\n        bail!(\n            \"The running executable path changed during the update; no further files were replaced. Run the intended executable again by its full path.\"\n        );\n    }\n    Ok(())\n}\n\n/// Only the running binary and copies of those exact bytes are ours to update.\n/// Command names alone do not establish ownership of an existing sibling.\nfn validate_update_target(target: &Path, identity: &UpdateExecutableIdentity) -> Result<()> {\n    if !InstallMethod::from_path(target).supports_self_update() || protected_update_path(target) {\n        bail!(\n            \"Refusing to replace managed/system path {}.\\n\\n{GITHUB_MIGRATION_HELP}\",\n            target.display()\n        );\n    }\n    let metadata = match std::fs::symlink_metadata(target) {\n        Ok(metadata) => metadata,\n        Err(error) if error.kind() == std::io::ErrorKind::NotFound && target != identity.path => {","sourceCodeStart":538,"sourceCodeEnd":574,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/cli/src/update.rs#L538-L574","documentation":"Before replacing files, the updater re-reads its own executable path and compares the SHA-256 of the bytes on disk to the hash recorded at update start. A mismatch means the file at the recorded path changed underneath the running process (it was replaced, edited, or a different binary now sits there), so the updater aborts having replaced nothing and tells the user to relaunch by full path.","triggerScenarios":"validate_primary_update_identity, called at the start of run_update's swap phase, when sha256_hex(std::fs::read(identity.path)) differs from identity.file_hash.","commonSituations":"Another update/install overwrote the binary while this one ran; the user or a tool edited or replaced the executable mid-update; running from a copy that was subsequently overwritten; a previous aborted swap left a different binary at the path.","solutions":["Run the intended executable again by its full path (as the message says) so the identity is recomputed against the bytes actually on disk, then retry the update.","Verify with `sha256sum <path>` which binary now occupies the path and reinstall the expected version if it is wrong.","Prevent concurrent writers: do not run two updaters or installers against the same install directory at once.","If it happens repeatedly, check antivirus/sync tools replacing the binary and exclude the install directory."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"let bytes = std::fs::read(&running_path)?;\nlet current = sha256_hex(&bytes);\nif current != recorded_hash {\n    eprintln!(\"binary at {running_path:?} changed since start; restart by full path before updating\");\n}","typeGuard":null,"tryCatchPattern":"match run_update() {\n    Err(e) if e.to_string().contains(\"running executable path changed\") => {\n        // no files were replaced; safely restart the intended binary by full path and retry\n    }\n    other => other?,\n}","preventionTips":["Never run two updaters against the same install directory concurrently.","Re-run the updater by its full path after any external modification of the binary.","Exclude install directories from sync/antivirus tools.","Record and compare the binary hash before launching an update session."],"tags":["self-update","checksum","race-condition"],"backgroundTag":"checksum-mismatch","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}