gitbutlerapp/gitbutler · warning
Unable to determine which reviews to target
Error message
Unable to determine which reviews to target
What it means
The review-targeting flow first requires at least one review (guarded by the earlier 'No reviews available to select' context) and then shows `prompt_multi_select("Please select the reviews you want to target.", ...)`. A `None` return — the user cancelled the picker — becomes this error via `ok_or_else`, so no review is targeted.
Source
Thrown at crates/but/src/command/legacy/forge/review.rs:1251
.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 caf1f223d3)
Solutions
- Re-run and select at least one review (Space to toggle, Enter to confirm)
- Or target reviews non-interactively using the CLI id selectors the command accepts (see `but forge review --help`)
- If the intent was to abort, nothing was modified — safe to ignore
Example fix
# before but forge review # (cancel at 'Please select the reviews you want to target.') # error: Unable to determine which reviews to target # after but forge review # toggle reviews with Space, confirm with Enter
Defensive patterns
Strategy: fallback
Validate before calling
# Skip the picker by passing review selectors on the command line # (the CLI resolves ids to reviews non-interactively; see but forge review --help) but forge review <selector>
Try / catch
# Distinguish cancellation from real failures in wrappers out=$(but forge review 2>&1); rc=$? if [ $rc -ne 0 ] && [[ "$out" == *"Unable to determine which reviews"* ]]; then exit 0; fi echo "$out"; exit $rc
Prevention
- Pass review ids explicitly in automation instead of relying on the picker
- Treat picker cancellation as a clean exit — nothing was modified
- Ensure automation runs without a TTY so the CLI asks for arguments instead
When it happens
Trigger: Running the review command for a branch that has reviews, reaching the multi-select, and cancelling it (Esc/Ctrl-C); `prompt_multi_select` returns None.
Common situations: User inspects the candidate reviews and decides to abort; terminal loses focus or resizes mid-prompt; automation accidentally inherits a TTY and the prompt gets killed.
Related errors
- No branches selected. Aborting.
- Selection aborted
- Interactive setup requires a terminal. Use `but agent setup
- cannot mix mark sources
- cannot mark files from multiple commits
AI-assisted analysis of gitbutlerapp/gitbutler@caf1f223d3 (2026-08-20).
Data as JSON: /api/errors/696458ea21a8f308.
Report an issue: GitHub.