gitbutlerapp/gitbutler · critical

Installation failed and backup restoration also failed -…

Error message

Installation failed and backup restoration also failed - 'but' command may not work

What it means

Thrown when the macOS install of the new app bundle fails AND restoring the backup also fails: after copying the backup back, validate_installed_binary(&but_symlink) reports the restored binary is not usable, leaving the `but` command potentially broken. This is the worst-case path of install_app's failure handling.

Solutions

  1. Check that the symlink target exists and is executable: `ls -l $(which but)` and `file` the target; recreate the symlink if dangling
  2. Run the installer again to force a fresh download and clean backup/restore cycle
  3. Manually reinstall: download the .app release, copy it over the broken bundle, and re-link `but` to Contents/MacOS/gitbutler-tauri
  4. Check disk space and quarantine attributes (`xattr -d com.apple.quarantine`) on the restored bundle

Example fix

// before
if validate_installed_binary(&but_symlink) { ... } else { bail!("Installation failed and backup restoration also failed - 'but' command may not work"); }
// after (shell recovery)
ln -sf "/Applications/GitButler.app/Contents/MacOS/gitbutler-tauri" ~/.local/bin/but && but --version
Defensive patterns

Strategy: retry

Validate before calling

fn backup_binary_valid(backup_dir: &std::path::Path) -> bool {
    let bin = backup_dir.join("Contents/MacOS/gitbutler-tauri");
    bin.exists() && bin.is_file()
}

Try / catch

if let Err(e) = download_and_install_app(...).await {
    if e.to_string().contains("backup restoration also failed") {
        // manual recovery: re-download release and reinstall
    }
}

Prevention

When it happens

Trigger: install_app fails mid-install, a backup exists and is restored over the target, but validate_installed_binary(&but_symlink) fails (restored binary missing, not executable, or symlink points at a broken path) — the else branch bails with this message.

Common situations: Backup itself was corrupted or incomplete, interrupted previous update left a partial backup, antivirus/quarantine stripping the executable bit, symlink target removed between restore and validation, full disk during restore copy.

Related errors


AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18). Data as JSON: /api/errors/06c1ae3b797b9b51. Report an issue: GitHub.

Appendix: source

Thrown at crates/but-installer/src/install_macos.rs:273

        }
    }

    if !validate_installed_binary(&but_symlink) {
        // Try to restore backup
        warn("Final installation verification failed - attempting to restore backup");
        if install_app_backup.exists() {
            fs::remove_dir_all(&install_app)?;
            fs::rename(&install_app_backup, &install_app)?;

            let restored_target = install_app.join("Contents/MacOS/gitbutler-tauri");
            let _ = fs::remove_file(&but_symlink);
            unix_fs::symlink(&restored_target, &but_symlink)?;

            if validate_installed_binary(&but_symlink) {
                success("Backup was restored successfully");
                bail!("Installation failed but your previous installation was restored");
            } else {
                bail!(
                    "Installation failed and backup restoration also failed - 'but' command may not work"
                );
            }
        } else {
            bail!("Installation failed and no backup available to restore");
        }
    }

    success(&format!(
        "{} installed successfully",
        app_basename.to_string_lossy()
    ));
    // Remove backup on success
    let _ = fs::remove_dir_all(&install_app_backup);

    success("GitButler CLI (but) installed successfully");

    Ok(())

View on GitHub (pinned to 58e5313667)