{"record":{"id":"314308e432bae77b","repo":"gitbutlerapp/gitbutler","slug":"installation-failed-but-your-previous-installation-314308","errorCode":null,"errorMessage":"Installation failed but your previous installation was restored","messagePattern":"Installation failed but your previous installation was restored","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-installer/src/install_macos.rs","lineNumber":271,"sourceCode":"        } else {\n            bail!(\"Failed to create symlink: {e}. No backup available to restore.\");\n        }\n    }\n\n    if !validate_installed_binary(&but_symlink) {\n        // Try to restore backup\n        warn(\"Final installation verification failed - attempting to restore backup\");\n        if install_app_backup.exists() {\n            fs::remove_dir_all(&install_app)?;\n            fs::rename(&install_app_backup, &install_app)?;\n\n            let restored_target = install_app.join(\"Contents/MacOS/gitbutler-tauri\");\n            let _ = fs::remove_file(&but_symlink);\n            unix_fs::symlink(&restored_target, &but_symlink)?;\n\n            if validate_installed_binary(&but_symlink) {\n                success(\"Backup was restored successfully\");\n                bail!(\"Installation failed but your previous installation was restored\");\n            } else {\n                bail!(\n                    \"Installation failed and backup restoration also failed - 'but' command may not work\"\n                );\n            }\n        } else {\n            bail!(\"Installation failed and no backup available to restore\");\n        }\n    }\n\n    success(&format!(\n        \"{} installed successfully\",\n        app_basename.to_string_lossy()\n    ));\n    // Remove backup on success\n    let _ = fs::remove_dir_all(&install_app_backup);\n\n    success(\"GitButler CLI (but) installed successfully\");","sourceCodeStart":253,"sourceCodeEnd":289,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/caf1f223d3cfb94488c9198ad34487c6006c648f/crates/but-installer/src/install_macos.rs#L253-L289","documentation":"Final macOS validation: after the swap, 'but --version' through the new symlink failed. The installer removed the new app, restored the backup, recreated the symlink, re-validated, and the restored version passes - so it bails with this message. Your previous installation is intact and working; the new artifact was rejected at run time.","triggerScenarios":"The new app's binary does not execute while the old one does: Gatekeeper quarantine blocking the freshly downloaded (e.g. unnotarized nightly) bundle, a corrupted download, or an x86_64 build on arm64 without Rosetta.","commonSituations":"Nightly channel on Gatekeeper-strict macOS; missing Rosetta; transient CDN corruption; MDM policy changes applied between versions.","solutions":["Keep using the restored old version - no repair is strictly needed","Check System Settings > Privacy & Security for a blocked-binary notice for the new version; allow it or switch to the notarized release channel","Install Rosetta on Apple Silicon if the new artifact is x86_64: softwareupdate --install-rosetta","Retry later in case of transient corruption"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// Pre-flight the staged binary the way the installer will (but --version)\nlet status = std::process::Command::new(&staged_but)\n    .arg(\"--version\")\n    .stdout(std::process::Stdio::null())\n    .stderr(std::process::Stdio::null())\n    .status();\nanyhow::ensure!(status.is_ok_and(|s| s.success()),\n    \"new binary blocked (Gatekeeper/Rosetta); skipping update\");","typeGuard":null,"tryCatchPattern":"match but_installer::run_installation_with_version(request, false) {\n    Err(e) if e.to_string().contains(\"previous installation was restored\") => {\n        // rollback already succeeded; old version is live. Keep it and report.\n        log::warn!(\"update rejected at validation; staying on previous version\");\n    }\n    result => result,\n}","preventionTips":["Prefer the notarized release channel over nightly on managed Macs","Keep Rosetta installed on Apple Silicon","Treat single-shot validation failure as transient: retry before pinning blame"],"tags":["rust","macos","gatekeeper","rollback-restored","binary-validation","but-installer"],"backgroundTag":"installation-rollback","analyzedSha":"caf1f223d3cfb94488c9198ad34487c6006c648f","analyzedAt":"2026-08-20T07:55:40.983Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}