{"record":{"id":"a27d1d78b27f1bef","repo":"gitbutlerapp/gitbutler","slug":"failed-to-move-new-installation-into-place-e","errorCode":null,"errorMessage":"Failed to move new installation into place: {e}","messagePattern":"Failed to move new installation into place: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-installer/src/install_macos.rs","lineNumber":222,"sourceCode":"        cleanup_artifacts();\n\n        // Critical failure - restore backup if we created one\n        if had_backup && install_app_backup.exists() {\n            warn(\"Failed to move new installation into place - restoring backup\");\n            if let Err(restore_err) = fs::rename(&install_app_backup, &install_app) {\n                bail!(\n                    \"Failed to install new version: {}. Also failed to restore backup: {}. Your app may be at {}\",\n                    e,\n                    restore_err,\n                    install_app_backup.display()\n                );\n            }\n            bail!(\n                \"Failed to install new version: {e}. Previous installation restored successfully.\"\n            );\n        }\n        // No backup to restore, just fail\n        bail!(\"Failed to move new installation into place: {e}\");\n    }\n\n    // Update the symlink to point to the new installation\n    let final_target = install_app.join(\"Contents/MacOS/gitbutler-tauri\");\n    let _ = fs::remove_file(&but_symlink);\n\n    // Try to create symlink and verify - if either fails, rollback\n    let symlink_result = unix_fs::symlink(&final_target, &but_symlink);\n    let _ = fs::remove_file(&but_new);\n\n    if let Err(e) = symlink_result {\n        // Symlink creation failed - rollback to backup\n        warn(&format!(\n            \"Failed to create symlink: {e} - attempting to restore backup\"\n        ));\n        if install_app_backup.exists() {\n            if let Err(remove_err) = fs::remove_dir_all(&install_app) {\n                bail!(","sourceCodeStart":204,"sourceCodeEnd":240,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/caf1f223d3cfb94488c9198ad34487c6006c648f/crates/but-installer/src/install_macos.rs#L204-L240","documentation":"First macOS install (no previous app, hence no backup): fs::rename moving the staged .app into the install location failed. Staged artifacts are cleaned up and the raw rename error is reported. Nothing pre-existing was damaged, but the install did not land.","triggerScenarios":"The install location is not writable by the current user (system /Applications without admin), the volume is full, or an unexpected object already occupies the target path in a form rename cannot atomically replace.","commonSituations":"Non-admin first install into /Applications on managed Macs; disk full; leftover partial bundle from a previous aborted install.","solutions":["Fix write permission on the install dir (or install as a user who owns it) and retry","Free disk space - the swap needs roughly twice the bundle size","Remove any partial leftover at the target path, then re-run but-installer"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Ensure the install dir is writable before a first install\nlet probe = install_dir.join(\".write-probe\");\nstd::fs::create_dir_all(&install_dir)?;\nstd::fs::write(&probe, b\"\")?;\nstd::fs::remove_file(&probe)?; // Err here = permission/disk problem, fix before install","typeGuard":null,"tryCatchPattern":"if let Err(e) = but_installer::run_installation_with_version(request, false) {\n    if e.to_string().contains(\"Failed to move new installation into place\") {\n        // surface the fs error: EACCES -> permissions, ENOSPC -> space, EBUSY -> app running\n        eprintln!(\"fix install-dir permissions/space and retry: {e}\");\n    }\n    return Err(e);\n}","preventionTips":["Run the installer as a user with write access to the install dir","Free disk space before installs (about 2x bundle size needed)","Remove leftover partial bundles at the target path before retrying"],"tags":["rust","macos","first-install","rename","permissions","disk-full","but-installer"],"backgroundTag":"installation-rollback","analyzedSha":"caf1f223d3cfb94488c9198ad34487c6006c648f","analyzedAt":"2026-08-20T07:55:40.983Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}