gitbutlerapp/gitbutler · info
CliInstallCancelled
CliInstallCancelled
Error message
Administrator authorization was cancelled
What it means
When the elevated install AppleScript prints 'gitbutler-cli-install-cancelled' (user clicked Cancel on the macOS administrator-privilege prompt, AppleScript error -128 userCanceled), check_cli_install_output maps it to this error carrying ErrorContext code CliInstallCancelled. It deliberately distinguishes an intentional user cancellation from a genuine script failure so callers can treat it as a no-op rather than a bug.
Solutions
- Nothing is broken — rerun the CLI install and click 'OK' after entering administrator credentials.
- Avoid the admin prompt entirely by using the per-user install mode (CurrentUserOnly), which installs the symlink into a user-writable PATH directory.
- If the code matches on this error, handle Code::CliInstallCancelled as an expected, user-initiated abort — do not surface it as a failure toast.
Example fix
// before
match result { Err(e) => show_error(e), ... }
// after
match result {
Err(e) if e.error_code() == Code::CliInstallCancelled => info!("install cancelled by user"),
Err(e) => show_error(e),
Ok(()) => {}
} Defensive patterns
Strategy: try-catch
Type guard
fn is_cancelled(e: &but_error::Error) -> bool { e.get_code() == Code::CliInstallCancelled } Try / catch
match install_cli_link_escalated(...) {
Err(e) if e.get_code() == Code::CliInstallCancelled => {
tracing::info!("user cancelled admin authorization; not an error");
}
Err(e) => report(e),
Ok(()) => {}
} Prevention
- Offer the CurrentUserOnly install mode to avoid the admin password prompt entirely.
- Treat Code::CliInstallCancelled as an expected outcome in UI/automation, never as a failure alert.
- Inform users up front that an administrator prompt will appear.
When it happens
Trigger: install_cli_link_escalated triggers the 'GitButler needs administrator access...' password dialog and the user clicks Cancel / authenticates unsuccessfully by cancelling; the script returns 'gitbutler-cli-install-cancelled'.
Common situations: User changes their mind about entering an admin password during CLI setup; the prompt is dismissed with Escape; enterprise policy blocks the privilege escalation dialog.
Related errors
- CLI installation failed
- Refusing to replace ' ', which points to ' ' instead of
- Unexpected CLI installer response
- A 'but' binary already exists at
- Could not find application for
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/9b049e44a41c887c.
Report an issue: GitHub.
Appendix: source
Thrown at crates/but-action/src/cli.rs:233
return "gitbutler-cli-installed"
on error messageText number errorNumber
if errorNumber is -128 then return "gitbutler-cli-install-cancelled"
error messageText number errorNumber
end try
end run
"#;
#[cfg(any(target_os = "macos", all(test, unix)))]
fn check_cli_install_output(output: std::process::Output) -> anyhow::Result<()> {
anyhow::ensure!(
output.status.success(),
"CLI installation failed ({}): {}",
output.status,
String::from_utf8_lossy(&output.stderr).trim()
);
if output.stdout == b"gitbutler-cli-install-cancelled\n" {
return Err(
anyhow!("Administrator authorization was cancelled").context(ErrorContext::new_static(
Code::CliInstallCancelled,
"CLI install cancelled",
)),
);
}
anyhow::ensure!(
output.stdout == b"gitbutler-cli-installed\n",
"Unexpected CLI installer response"
);
Ok(())
}
#[cfg(target_os = "macos")]
pub fn auto_fix_broken_but_cli_symlink() {
let Ok(absolute_link_destination) = std::fs::read_link(UNIX_LINK_PATH) else {
return;
};
if absolute_link_destination.exists() {View on GitHub (pinned to 58e5313667)