{"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/caf1f223d3cfb94488c9198ad34487c6006c648f/crates/but/src/command/legacy/forge/review.rs#L592-L628","documentation":"In the `but forge review` publish path, once branches without reviews are collected, an interactive multi-select (`prompt_multi_select(\"Select branches to publish\", ...)`) is shown. A `None` return from that prompt — a cancelled picker, not a confirmed empty selection — is converted via `ok_or_else` into this error, so nothing gets published.","triggerScenarios":"Running the publish flow without branch arguments in a terminal and pressing Esc/Ctrl-C at the 'Select branches to publish' multi-select; `prompt_multi_select` returns None and the `ok_or_else` arm fires.","commonSituations":"User opens the picker to look around and backs out; SSH session drops or terminal closes mid-prompt; muscle memory from tools where Esc means 'accept default'.","solutions":["Re-run and confirm at least one branch: Space to toggle, Enter to accept","Pass the branches to publish as command-line arguments so no picker opens (see `but forge review --help` for the argument form)","Treat the abort as a clean no-op — no branches were published"],"exampleFix":"# before\nbut forge review --publish\n# (cancel the multi-select with Esc)\n# error: No branches selected. Aborting.\n\n# after\nbut forge review --publish   # select with Space, confirm with Enter\n# or name branches on the command line to skip the picker","handlingStrategy":"fallback","validationCode":"# Script-safe: avoid the interactive picker by passing branch arguments\n# (the picker only appears when no branches are given; see but forge review --help)\nbut forge review --publish <branch>","typeGuard":null,"tryCatchPattern":"# Cancellation is a no-op, not a failure — map it to exit 0 in wrappers\nstderr=$(but forge review --publish 2>&1 >/dev/null) || {\n  [[ \"$stderr\" == *\"No branches selected\"* ]] && exit 0   # cancelled on purpose\n  echo \"$stderr\" >&2; exit 1\n}","preventionTips":["Never rely on interactive pickers in scripts — always pass branch arguments","Remember Esc cancels with zero side effects; Enter accepts","If a picker is unwanted, name the branches on the command line"],"tags":["interactive","prompt","forge-review","publish"],"backgroundTag":"interactive-prompt-cancelled","analyzedSha":"caf1f223d3cfb94488c9198ad34487c6006c648f","analyzedAt":"2026-08-20T07:55:40.983Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}