{"record":{"id":"a1fa2d62630f2746","repo":"Hmbown/CodeWhale","slug":"max-passes-applies-only-to-pr-reviews","errorCode":null,"errorMessage":"--max-passes applies only to --pr reviews","messagePattern":"--max-passes applies only to --pr reviews","errorType":"error_code","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/lib.rs","lineNumber":9082,"sourceCode":"}\n\nfn resolve_review_model(config: &Config, explicit_model: Option<&str>) -> String {\n    explicit_model\n        .map(str::trim)\n        .filter(|model| !model.is_empty())\n        .map(str::to_string)\n        .unwrap_or_else(|| config.default_model())\n}\n\nfn validate_review_receipt_args(args: &ReviewArgs) -> Result<()> {\n    if args.receipt_path.is_some() && !args.write_receipt && !args.check_receipt {\n        bail!(\"--receipt-path requires --write-receipt or --check-receipt\");\n    }\n    if args.write_receipt && args.check_receipt {\n        bail!(\"--write-receipt and --check-receipt are mutually exclusive\");\n    }\n    if args.pr.is_none() && args.max_passes != 1 {\n        bail!(\"--max-passes applies only to --pr reviews\");\n    }\n    if !(1..=crate::tools::review::MAX_REVIEW_PASSES).contains(&args.max_passes) {\n        bail!(\n            \"--max-passes must be from 1 to {}\",\n            crate::tools::review::MAX_REVIEW_PASSES\n        );\n    }\n    Ok(())\n}\n\nfn run_review_receipt_check(\n    diff: &str,\n    args: &ReviewArgs,\n    pr_view: Option<&GhPullRequest>,\n) -> Result<()> {\n    let (path, receipt) = if let Some(path) = args.receipt_path.as_ref() {\n        (\n            path.clone(),","sourceCodeStart":9064,"sourceCodeEnd":9100,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/lib.rs#L9064-L9100","documentation":"Guard in the review-receipt/CLI argument validation path: the --max-passes flag limits repeated review iterations, which is only meaningful when reviewing a pull request (--pr). Passing --max-passes without --pr leaves the flag with no target, so validation rejects the combination up front rather than silently ignoring the option.","triggerScenarios":"Running a review without --pr while explicitly setting --max-passes to something other than 1.","commonSituations":"Reusing a PR-review command line for a local/diff review and forgetting to remove --max-passes; assuming multi-pass applies to all review modes.","solutions":["Add --pr if you intended a multi-pass PR review","Remove --max-passes (or set it to 1) for non-PR reviews"],"exampleFix":"// before\ncodewhale review --max-passes 3\n// after\ncodewhale review --pr 123 --max-passes 3","handlingStrategy":"validation","validationCode":"if (!args.pr && args.max_passes !== 1) {\n  throw new Error(\"--max-passes applies only to --pr reviews\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only set --max-passes together with --pr","Keep separate command templates for PR vs local reviews","Default --max-passes to 1 unless doing a --pr review"],"tags":["cli","argument-validation","review"],"backgroundTag":"invalid-flag-value","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-22T16:17:23.217Z"}