{"record":{"id":"c499aedfc3292fc1","repo":"gitbutlerapp/gitbutler","slug":"selection-aborted","errorCode":null,"errorMessage":"Selection aborted","messagePattern":"Selection aborted","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/but/src/command/legacy/push.rs","lineNumber":926,"sourceCode":"            (label, candidate.branch_name.clone())\n        })\n        .collect::<Vec<_>>();\n    let options = nonempty::NonEmpty::from_vec(options).context(\"No branches available to push\")?;\n    let mut input = out\n        .prepare_for_terminal_input()\n        .context(\"Human input required - run this in a terminal\")?;\n\n    // Preselect everything so plain Enter pushes all candidates; the picker\n    // starts empty otherwise, making Enter a silent no-op.\n    let selected_branches = input\n        .prompt_multi_select_with_help(\n            \"Which branch(es) would you like to push?\",\n            &options,\n            (0..options.len()).collect(),\n            Vec::new(),\n            |_| None,\n        )?\n        .ok_or_else(|| anyhow::anyhow!(\"Selection aborted\"))?\n        .into_iter()\n        .cloned()\n        .collect::<Vec<_>>();\n\n    if selected_branches.is_empty() {\n        Ok(BranchSelection::None)\n    } else {\n        Ok(BranchSelection::Selected(selected_branches))\n    }\n}\n\n/// A branch worth offering for push: the topmost branch with unpushed commits\n/// in its stack. Pushing a branch always pushes its stack ancestors too, so\n/// lower branches of the same stack are folded into one candidate instead of\n/// being offered (and pushed) separately.\nstruct PushCandidate {\n    branch_name: String,\n    /// Unpushed commits across this branch and its ancestors.","sourceCodeStart":908,"sourceCodeEnd":944,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but/src/command/legacy/push.rs#L908-L944","documentation":"handle_no_branch_specified throws 'Selection aborted' when the interactive branch multi-select (shown when no branch is given to `but push`) is cancelled or returns no selection. It is the expected abort path for the prompt, not an internal failure.","triggerScenarios":"Running `but push` without arguments, then pressing Esc/Ctrl+C or confirming an empty selection at the 'Which branch(es) would you like to push?' prompt.","commonSituations":"Users backing out of an accidental push, terminal issues making the multi-select unusable, or automation invoking push without args in a non-TTY environment.","solutions":["Re-run `but push` and select at least one branch","Specify branches explicitly: `but push branch-a`","For scripting, always pass branch names to avoid the interactive prompt entirely"],"exampleFix":"// before\nbut push  # interactive selection aborted\n// after\nbut push my-branch  # explicit, no prompt","handlingStrategy":"try-catch","validationCode":"// pass branches explicitly so no interactive prompt appears\nif (!branchArgs.length) {\n  throw new Error('Specify branches to push');\n}\nawait runBut(['push', ...branchArgs]);","typeGuard":"function selectionMade<T>(sel: T[] | null): sel is T[] {\n  return Array.isArray(sel) && sel.length > 0;\n}","tryCatchPattern":"try {\n  await runBut(['push']);\n} catch (e) {\n  if (/Selection aborted/.test(e.message)) {\n    console.warn('Push cancelled: no branches selected');\n    return;\n  }\n  throw e;\n}","preventionTips":["Always specify branches in scripts and CI","Select at least one branch before confirming the prompt","Use Ctrl+C intentionally and expect this abort message"],"tags":["cli","interactive","push","user-abort"],"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"}