gitbutlerapp/gitbutler · error
Could not determine selected review template
Error message
Could not determine selected review template
What it means
`but forge review-template set` optionally prompts the user to pick a review template. When no explicit template is passed on the command line, the interactive `prompt_select` result is unwrapped; a `None` (cancelled prompt or non-interactive input) becomes this anyhow error because a template must be chosen to store.
Solutions
- Pass the template path directly as a command-line argument to avoid the interactive prompt
- Run the command in an interactive terminal and complete the selection
- Verify no review templates are configured — if the list is empty, add a template first or pass an explicit path
- Cancel gracefully is unsupported; either complete the prompt or supply the argument
Example fix
// before: relies on interactive picker in a script but forge review-template set # Error: Could not determine selected review template // after: pass the template explicitly but forge review-template set .gitbutler/review-template.md
Defensive patterns
Strategy: validation
Validate before calling
# pass the template path explicitly instead of relying on the picker
[ -n "$TEMPLATE_PATH" ] || { echo "usage: but forge review-template set <path>"; exit 1; } Try / catch
match result {
Err(e) if e.to_string().contains("review template") => {
eprintln!("Template selection aborted; pass the path explicitly.");
}
r => r?,
} Prevention
- Always pass the template path as an argument in scripts
- Configure at least one review template before using the picker
- Run interactively only in a working TTY
When it happens
Trigger: Running the review-template set command without a path argument in a non-interactive environment, or cancelling the 'Select a review template' picker, so prompt_select yields None.
Common situations: Scripted/CI invocations omitting the template argument while relying on the interactive fallback; users pressing Esc/Ctrl-C expecting cancel; terminals where the selection UI fails.
Understand the failure class
Background: "Must pass :limit option" / "Missing required option" — required option errors explained — this error's family across 41 libraries.
Related errors
- Could not determine Anthropic credential source
- Could not determine OpenAI credential source
- Could not determine selected AI provider
- Could not determine which accounts to delete
- Known account is not correctly authenticated. Run
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/2c56474ec5b98fd0.
Report an issue: GitHub.
Appendix: 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 58e5313667)