gitbutlerapp/gitbutler · warning

Unable to determine which reviews to target

Error message

Unable to determine which reviews to target

What it means

interactive_review_id_selection throws this when the multi-select prompt for choosing which existing reviews to target yields no selection. Without a user-chosen set of review IDs, the command cannot know which reviews to act on, so it aborts.

Solutions

  1. Re-run and select at least one review in the prompt
  2. Specify the target review IDs explicitly via command line arguments if supported
  3. Ensure the terminal is a real TTY so the multi-select renders and captures input correctly

Example fix

// before
but forge review  # aborted selection prompt
// after
but forge review --id 42  # explicit target, no prompt
Defensive patterns

Strategy: try-catch

Validate before calling

// resolve reviews non-interactively where possible
if (reviewIds.length === 0) {
  throw new Error('No reviews to target');
}
await runBut(['forge', 'review', ...reviewIds]);

Type guard

function hasReviewSelection<T>(sel: readonly T[] | null): sel is readonly T[] {
  return sel !== null && sel.length > 0;
}

Try / catch

try {
  await runBut(['forge', 'review']);
} catch (e) {
  if (/Unable to determine which reviews/.test(e.message)) {
    console.warn('Review targeting aborted by user');
    return;
  }
  throw e;
}

Prevention

When it happens

Trigger: Running a review-targeting command that resolves multiple candidate reviews, entering the interactive prompt, and aborting (Esc/Ctrl+C) or confirming with nothing selected.

Common situations: Users changing their mind mid-prompt, terminal multiplexers intercepting Esc keys, or non-TTY environments degrading the multi-select into a no-op.

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


AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18). Data as JSON: /api/errors/696458ea21a8f308. Report an issue: GitHub.

Appendix: source

Thrown at crates/but/src/command/legacy/forge/review.rs:1249

        .flat_map(|stack| {
            stack.branches.iter().filter_map(|branch| {
                let review_id = branch.review_id?;
                Some((format!("{} ({})", branch.name, review_id), review_id))
            })
        })
        .collect::<Vec<_>>();
    let branch_reviews =
        nonempty::NonEmpty::from_vec(branch_reviews).context("No reviews available to select")?;
    let mut input = out
        .prepare_for_terminal_input()
        .context("Human input required - run this in a terminal")?;

    let selected_reviews = input
        .prompt_multi_select(
            "Please select the reviews you want to target.",
            &branch_reviews,
        )?
        .ok_or_else(|| anyhow::anyhow!("Unable to determine which reviews to target"))?
        .into_iter()
        .copied()
        .collect::<Vec<_>>();

    Ok(selected_reviews)
}

fn resolve_cli_ids_to_review_ids(
    ctx: &mut Context,
    selector: &str,
    applied_stacks: &[HeadInfoStack],
    id_map: &IdMap,
) -> Vec<usize> {
    parse_sources(ctx, id_map, selector)
        .ok()
        .unwrap_or_default()
        .into_iter()
        .filter_map(|cli_id| match cli_id {

View on GitHub (pinned to 58e5313667)