gitbutlerapp/gitbutler · warning
Could not determine selected review template
Error message
Could not determine selected review template
What it means
When setting a forge review template and multiple templates are available, the command shows a prompt_select picker; this error occurs when the picker is cancelled (returns None) so no template path is chosen. The previously-guarded empty-list case is handled by the 'No review templates available' context, so reaching this line means templates existed but no selection was confirmed. Nothing is written (set_review_template is only called after selection).
Source
Thrown at crates/but/src/command/legacy/forge/review.rs:292
} else {
template.clone()
};
(label, template)
})
.collect::<Vec<_>>();
let template_options = nonempty::NonEmpty::from_vec(template_options)
.context("No review templates available")?;
let selected_template = {
let mut input = out
.prepare_for_terminal_input()
.context("Human input required - run this in a terminal")?;
input
.prompt_select(
"Select a review template (and press Enter)",
&template_options,
)?
.cloned()
.ok_or_else(|| anyhow::anyhow!("Could not determine selected review template"))?
};
let message = format!("Set review template path to: {}", &selected_template);
but_api::legacy::forge::set_review_template(ctx, Some(selected_template.clone()))?;
if let Some(out) = out.for_human() {
writeln!(out, "{message}")?;
}
}
Ok(())
}
/// Create a new forge review for a branch.
/// If no branch is specified, prompts the user to select one.
/// If there is only one branch without a an acco, asks for confirmation.
#[expect(clippy::too_many_arguments)]
pub async fn create_review(
ctx: &mut Context,
branch: Option<String>,View on GitHub (pinned to caf1f223d3)
Solutions
- Re-run and confirm a template with Enter.
- If you already know the path, pass it directly as the argument to skip the picker.
- Verify templates exist where the tool looks (.gitbutler/template dirs / configured paths) if the list surprises you.
Defensive patterns
Strategy: try-catch
Validate before calling
// Skip the picker by passing the template path explicitly when known // e.g. but forge review set-template .gitbutler/template/default.md
Try / catch
match set_review_template_interactive(out).await {
Err(e) if e.to_string().contains("Could not determine selected review template") => {
println!("Template selection cancelled; no change made."); Ok(())
}
other => other,
} Prevention
- Pass the template path directly to avoid the interactive step.
- Keep templates in the conventional location so the list stays meaningful.
When it happens
Trigger: Running the review-template set command with several templates configured, then pressing Esc/Ctrl-C in the 'Select a review template' picker.
Common situations: User browsing available templates before deciding; aborting to inspect template contents first.
Related errors
- Could not determine which forge provider to authenticate wit
- Could not determine authentication method
- Could not determine which accounts to delete
- Could not determine selected AI provider
- Could not determine OpenAI credential source
AI-assisted analysis of gitbutlerapp/gitbutler@caf1f223d3 (2026-08-20).
Data as JSON: /api/errors/2c56474ec5b98fd0.
Report an issue: GitHub.