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

  1. Re-run `but land <branch>` and answer Yes, or pass `--yes` to skip the prompt.
  2. Before confirming, double-check the branch and target named in the prompt against `but status`.
  3. 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

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


AI-assisted analysis of gitbutlerapp/gitbutler@caf1f223d3 (2026-08-20). Data as JSON: /api/errors/17e52914e6436e7c. Report an issue: GitHub.