{"record":{"id":"4f06a0371adaf728","repo":"gitbutlerapp/gitbutler","slug":"no-branches-selected-aborting","errorCode":null,"errorMessage":"No branches selected. Aborting.","messagePattern":"No branches selected\\. Aborting\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/but/src/command/legacy/forge/review.rs","lineNumber":610,"sourceCode":"                ),\n                branch.name.clone(),\n            ));\n        }\n    }\n\n    let Some(branch_options) = nonempty::NonEmpty::from_vec(branch_options) else {\n        if let Some(out) = out.for_human() {\n            writeln!(out, \"No branches available to publish.\")?;\n        }\n        return Ok(vec![]);\n    };\n\n    let mut input = out\n        .prepare_for_terminal_input()\n        .context(\"Terminal input not available. Please specify branches to publish using command line arguments.\")?;\n    let selected_branches = input\n        .prompt_multi_select(\"Select branches to publish\", &branch_options)?\n        .ok_or_else(|| anyhow::anyhow!(\"No branches selected. Aborting.\"))?\n        .into_iter()\n        .cloned()\n        .collect();\n\n    Ok(selected_branches)\n}\n\n#[expect(clippy::too_many_arguments)]\nasync fn publish_reviews_for_branch_and_dependents(\n    ctx: &mut Context,\n    branch_name: &str,\n    review_map: &std::collections::HashMap<String, Vec<but_forge::ForgeReview>>,\n    stack_entry: &HeadInfoStack,\n    skip_force_push_protection: bool,\n    with_force: bool,\n    run_hooks: bool,\n    default_message: bool,\n    draft: bool,","sourceCodeStart":592,"sourceCodeEnd":628,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but/src/command/legacy/forge/review.rs#L592-L628","documentation":"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.","triggerScenarios":"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.","commonSituations":"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'.","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"],"exampleFix":"// before\nbut forge publish  # interactive prompt aborted\n// after\nbut forge publish branch-a branch-b  # non-interactive, no prompt","handlingStrategy":"validation","validationCode":"// skip interactive prompt by passing branches explicitly\nconst branches = await getBranches();\nif (branches.length === 0) return;\nawait runBut(['forge', 'publish', ...branches]);","typeGuard":"function hasSelection<T>(sel: T[] | null): sel is T[] {\n  return Array.isArray(sel) && sel.length > 0;\n}","tryCatchPattern":"try {\n  await runBut(['forge', 'publish']);\n} catch (e) {\n  if (/No branches selected/.test(e.message)) {\n    console.warn('Publish aborted: no branches selected');\n    return;\n  }\n  throw e;\n}","preventionTips":["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"],"tags":["cli","interactive","user-abort","branch-selection"],"backgroundTag":"missing-required-argument","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}