gitbutlerapp/gitbutler · warning
No branches selected. Aborting.
Error message
No branches selected. Aborting.
What it means
prompt_for_branch_selection throws this when the interactive multi-select for branches to publish returns no selection (user deselected everything or aborted the prompt). The operation is deliberately aborted rather than proceeding with an empty branch set.
Solutions
- Re-run the command and select at least one branch in the prompt
- Pass the branches explicitly via command line arguments to skip the interactive prompt
- Use Ctrl+C cleanly to abort; the abort message is expected behavior
Example fix
// before but forge publish # interactive prompt aborted // after but forge publish branch-a branch-b # non-interactive, no prompt
Defensive patterns
Strategy: validation
Validate before calling
// skip interactive prompt by passing branches explicitly const branches = await getBranches(); if (branches.length === 0) return; await runBut(['forge', 'publish', ...branches]);
Type guard
function hasSelection<T>(sel: T[] | null): sel is T[] {
return Array.isArray(sel) && sel.length > 0;
} Try / catch
try {
await runBut(['forge', 'publish']);
} catch (e) {
if (/No branches selected/.test(e.message)) {
console.warn('Publish aborted: no branches selected');
return;
}
throw e;
} Prevention
- Pass branch names as CLI args to avoid prompts in scripts
- Select at least one branch before confirming the multi-select
- Detect non-TTY environments and always pass explicit args
When it happens
Trigger: Running a publish/review flow with multiple branches in the workspace without specifying branches on the command line, then pressing Esc / confirming an empty selection at the 'Select branches to publish' multi-select.
Common situations: Developers launching the interactive prompt by accident, pressing Ctrl+C/Esc to back out, or deselecting all options thinking that means 'skip' rather than 'abort'.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Selection aborted
- Unable to determine which reviews to target
- Could not determine which forge provider to authenticate…
- Editor cancelled
- Human input required - run this in a terminal, or specify…
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/4f06a0371adaf728.
Report an issue: GitHub.
Appendix: source
Thrown at crates/but/src/command/legacy/forge/review.rs:610
),
branch.name.clone(),
));
}
}
let Some(branch_options) = nonempty::NonEmpty::from_vec(branch_options) else {
if let Some(out) = out.for_human() {
writeln!(out, "No branches available to publish.")?;
}
return Ok(vec![]);
};
let mut input = out
.prepare_for_terminal_input()
.context("Terminal input not available. Please specify branches to publish using command line arguments.")?;
let selected_branches = input
.prompt_multi_select("Select branches to publish", &branch_options)?
.ok_or_else(|| anyhow::anyhow!("No branches selected. Aborting."))?
.into_iter()
.cloned()
.collect();
Ok(selected_branches)
}
#[expect(clippy::too_many_arguments)]
async fn publish_reviews_for_branch_and_dependents(
ctx: &mut Context,
branch_name: &str,
review_map: &std::collections::HashMap<String, Vec<but_forge::ForgeReview>>,
stack_entry: &HeadInfoStack,
skip_force_push_protection: bool,
with_force: bool,
run_hooks: bool,
default_message: bool,
draft: bool,View on GitHub (pinned to 58e5313667)