{"record":{"id":"2c56474ec5b98fd0","repo":"gitbutlerapp/gitbutler","slug":"could-not-determine-selected-review-template","errorCode":null,"errorMessage":"Could not determine selected review template","messagePattern":"Could not determine selected review template","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but/src/command/legacy/forge/review.rs","lineNumber":292,"sourceCode":"                } else {\n                    template.clone()\n                };\n                (label, template)\n            })\n            .collect::<Vec<_>>();\n        let template_options = nonempty::NonEmpty::from_vec(template_options)\n            .context(\"No review templates available\")?;\n        let selected_template = {\n            let mut input = out\n                .prepare_for_terminal_input()\n                .context(\"Human input required - run this in a terminal\")?;\n            input\n                .prompt_select(\n                    \"Select a review template (and press Enter)\",\n                    &template_options,\n                )?\n                .cloned()\n                .ok_or_else(|| anyhow::anyhow!(\"Could not determine selected review template\"))?\n        };\n        let message = format!(\"Set review template path to: {}\", &selected_template);\n        but_api::legacy::forge::set_review_template(ctx, Some(selected_template.clone()))?;\n        if let Some(out) = out.for_human() {\n            writeln!(out, \"{message}\")?;\n        }\n    }\n\n    Ok(())\n}\n\n/// Create a new forge review for a branch.\n/// If no branch is specified, prompts the user to select one.\n/// If there is only one branch without a an acco, asks for confirmation.\n#[expect(clippy::too_many_arguments)]\npub async fn create_review(\n    ctx: &mut Context,\n    branch: Option<String>,","sourceCodeStart":274,"sourceCodeEnd":310,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but/src/command/legacy/forge/review.rs#L274-L310","documentation":"`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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before: relies on interactive picker in a script\nbut forge review-template set  # Error: Could not determine selected review template\n\n// after: pass the template explicitly\nbut forge review-template set .gitbutler/review-template.md","handlingStrategy":"validation","validationCode":"# pass the template path explicitly instead of relying on the picker\n[ -n \"$TEMPLATE_PATH\" ] || { echo \"usage: but forge review-template set <path>\"; exit 1; }","typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"review template\") => {\n        eprintln!(\"Template selection aborted; pass the path explicitly.\");\n    }\n    r => r?,\n}","preventionTips":["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"],"tags":["cli","interactive-prompt","forge","review-template"],"backgroundTag":"missing-required-option","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"}