gitbutlerapp/gitbutler · info
Land cancelled
Error message
Land cancelled
What it means
The interactive confirmation for landing directly onto the target branch ('Land X directly onto Y?') defaults to No (`ConfirmDefault::No`). Answering 'n' — or just pressing Enter — makes the CLI bail with 'Land cancelled'. Nothing was modified; this is a clean, user-initiated abort.
Source
Thrown at crates/but/src/command/legacy/land/messaging.rs:242
}
if yes {
return Ok(());
}
let Some(mut inout) = out.prepare_for_terminal_input() else {
bail!(
"Refusing to directly update {target_display} without confirmation. Re-run with --yes to confirm."
);
};
let question = if extras.is_empty() {
format!("Land {branch_name} directly onto {target_display}?")
} else {
format!("Land {branch_name} and everything below it directly onto {target_display}?")
};
if inout.confirm(question, ConfirmDefault::No)? == Confirm::No {
bail!("Land cancelled");
}
Ok(())
}
/// The open pull-request numbers attached to `branch_name` or any of `lower_segments`. Landing
/// deletes each landed branch's remote copy, which closes the attached reviews on the forge, so
/// all are surfaced.
///
/// Only applied workspace segments can land, so this reads the forge review associations that
/// `head_info` projects onto the workspace segments (`segment.metadata.review.pull_request` is
/// overwritten from the forge review cache there, not stored state) instead of computing the
/// repository-wide branch listing.
pub(super) fn attached_pr_numbers(
ctx: &Context,
branch_name: &str,
lower_segments: &[String],
) -> anyhow::Result<Vec<(String, usize)>> {View on GitHub (pinned to caf1f223d3)
Solutions
- Re-run `but land <branch>` and answer Yes, or pass `--yes` to skip the prompt.
- Before confirming, double-check the branch and target named in the prompt against `but status`.
- If the prompt names the wrong branch, you passed the wrong ID: re-resolve it from `but status`.
Defensive patterns
Strategy: try-catch
Try / catch
# Distinguish a deliberate cancel from a real failure by exit status + message
if ! but land "$branch" 2>err.txt; then
if grep -q 'Land cancelled' err.txt; then
echo 'land skipped by user'
else
cat err.txt; exit 1
fi
fi Prevention
- Use `--yes` in automation where cancellation should not interrupt the pipeline.
- Treat an exit with 'Land cancelled' as a no-op success in scripts.
When it happens
Trigger: Answering No (or bare Enter, since the default is No) at the 'Land <branch> directly onto <target>?' prompt produced by land/messaging.rs:242.
Common situations: Declining after actually reading the direct-update warning; Enter-key habit carried over from prompts that default to Yes; cancelling after spotting the wrong branch or target in the question.
Related errors
- Refusing to directly update {target_display} without confirm
- `but land` requires an active GitButler workspace (`gitbutle
- Could not find branch: {branch_id}
- Ambiguous branch '{branch_id}', matches multiple items
- Expected a branch ID, got {}
AI-assisted analysis of gitbutlerapp/gitbutler@caf1f223d3 (2026-08-20).
Data as JSON: /api/errors/17e52914e6436e7c.
Report an issue: GitHub.