{"record":{"id":"9cdfa78fb2b120e3","repo":"Hmbown/CodeWhale","slug":"max-passes-must-be-from-1-to","errorCode":null,"errorMessage":"--max-passes must be from 1 to {}","messagePattern":"--max-passes must be from 1 to (.+?)","errorType":"error_code","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/lib.rs","lineNumber":9085,"sourceCode":"    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(),\n            crate::tools::review::read_review_receipt(path)\n                .with_context(|| format!(\"failed to read review receipt {}\", path.display()))?,\n        )","sourceCodeStart":9067,"sourceCodeEnd":9103,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/lib.rs#L9067-L9103","documentation":"Range validation of --max-passes: the value must be between 1 and MAX_REVIEW_PASSES (crate::tools::review::MAX_REVIEW_PASSES). Values outside that inclusive range are rejected before the review starts.","triggerScenarios":"Running `codewhale review --pr <N> --max-passes 0` or a value greater than MAX_REVIEW_PASSES.","commonSituations":"Typo like --max-passes 10 when the cap is lower; zero/negative values from a computed script variable; cap changed between tool versions making an old script invalid.","solutions":["Set --max-passes to a value from 1 up to MAX_REVIEW_PASSES (the error names the current cap)","Omit --max-passes to use the default of 1","Check the current cap in crates/tools/review if your script pins a value"],"exampleFix":"// before\ncodewhale review --pr 123 --max-passes 0\n// after\ncodewhale review --pr 123 --max-passes 2","handlingStrategy":"validation","validationCode":"if (!(Number.isInteger(args.max_passes) && args.max_passes >= 1 && args.max_passes <= MAX_REVIEW_PASSES)) {\n  throw new Error(`--max-passes must be 1..${MAX_REVIEW_PASSES}`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Clamp or validate --max-passes against the published cap before invoking","Re-check the cap when upgrading codewhale; it can change","Prefer omitting the flag over hardcoding edge values in scripts"],"tags":["cli","argument-validation","range"],"backgroundTag":"value-out-of-range","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}