gitbutlerapp/gitbutler · warning

Selection aborted

Error message

Selection aborted

What it means

`but push` with several unpushed candidates opens `prompt_multi_select_with_help("Which branch(es) would you like to push?", ...)` with every option preselected, so plain Enter pushes all candidates. A `None` return — a cancelled prompt — becomes this error; a confirmed-but-empty selection is separately mapped to `BranchSelection::None`.

Source

Thrown at crates/but/src/command/legacy/push.rs:930

            (label, candidate.branch_name.clone())
        })
        .collect::<Vec<_>>();
    let options = nonempty::NonEmpty::from_vec(options).context("No branches available to push")?;
    let mut input = out
        .prepare_for_terminal_input()
        .context("Human input required - run this in a terminal")?;

    // Preselect everything so plain Enter pushes all candidates; the picker
    // starts empty otherwise, making Enter a silent no-op.
    let selected_branches = input
        .prompt_multi_select_with_help(
            "Which branch(es) would you like to push?",
            &options,
            (0..options.len()).collect(),
            Vec::new(),
            |_| None,
        )?
        .ok_or_else(|| anyhow::anyhow!("Selection aborted"))?
        .into_iter()
        .cloned()
        .collect::<Vec<_>>();

    if selected_branches.is_empty() {
        Ok(BranchSelection::None)
    } else {
        Ok(BranchSelection::Selected(selected_branches))
    }
}

/// A branch worth offering for push: the topmost branch with unpushed commits
/// in its stack. Pushing a branch always pushes its stack ancestors too, so
/// lower branches of the same stack are folded into one candidate instead of
/// being offered (and pushed) separately.
struct PushCandidate {
    branch_name: String,
    /// Unpushed commits across this branch and its ancestors.

View on GitHub (pinned to caf1f223d3)

Solutions

  1. Press Enter to accept the preselected full list
  2. Space-toggle individual branches, then Enter
  3. Name the branch to skip the picker entirely: `but push <branch>`
  4. If aborted on purpose, note that nothing was pushed — no state changed

Example fix

# before
but push
# (cancel the 'Which branch(es) would you like to push?' picker)
# error: Selection aborted

# after
but push              # Enter pushes all preselected candidates
but push my-branch    # or skip the picker by naming the branch
Defensive patterns

Strategy: fallback

Validate before calling

# Script-safe: name branches so no picker appears
but push my-branch

Try / catch

# Map cancellation to a clean exit in wrappers
out=$(but push 2>&1); rc=$?
if [ $rc -ne 0 ] && [[ "$out" == *"Selection aborted"* ]]; then exit 0; fi
echo "$out"; exit $rc

Prevention

When it happens

Trigger: Running `but push` interactively with multiple branches that have unpushed commits and cancelling the picker with Esc/Ctrl-C.

Common situations: User opens the picker to inspect candidates and aborts; terminal multiplexer sends an unexpected key; automation surprised by an inherited TTY.

Related errors


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