Hmbown/CodeWhale · error · anyhow::Error
--max-passes must be from 1 to
Error message
--max-passes must be from 1 to {} What it means
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.
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
Example fix
// before codewhale review --pr 123 --max-passes 0 // after codewhale review --pr 123 --max-passes 2
Defensive patterns
Strategy: validation
Validate before calling
if (!(Number.isInteger(args.max_passes) && args.max_passes >= 1 && args.max_passes <= MAX_REVIEW_PASSES)) {
throw new Error(`--max-passes must be 1..${MAX_REVIEW_PASSES}`);
} Prevention
- 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
When it happens
Trigger: Running `codewhale review --pr <N> --max-passes 0` or a value greater than MAX_REVIEW_PASSES.
Common situations: 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.
Understand the failure class
Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.
Related errors
- Choose one input source, an unused --output path (or…
- --days must be an integer from 1 through 90
- duration resolved to zero seconds
- invalid value ' ' for '--provider ': expected one of …
- --max-passes applies only to --pr reviews
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/9cdfa78fb2b120e3.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/lib.rs:9085
explicit_model
.map(str::trim)
.filter(|model| !model.is_empty())
.map(str::to_string)
.unwrap_or_else(|| config.default_model())
}
fn validate_review_receipt_args(args: &ReviewArgs) -> Result<()> {
if args.receipt_path.is_some() && !args.write_receipt && !args.check_receipt {
bail!("--receipt-path requires --write-receipt or --check-receipt");
}
if args.write_receipt && args.check_receipt {
bail!("--write-receipt and --check-receipt are mutually exclusive");
}
if args.pr.is_none() && args.max_passes != 1 {
bail!("--max-passes applies only to --pr reviews");
}
if !(1..=crate::tools::review::MAX_REVIEW_PASSES).contains(&args.max_passes) {
bail!(
"--max-passes must be from 1 to {}",
crate::tools::review::MAX_REVIEW_PASSES
);
}
Ok(())
}
fn run_review_receipt_check(
diff: &str,
args: &ReviewArgs,
pr_view: Option<&GhPullRequest>,
) -> Result<()> {
let (path, receipt) = if let Some(path) = args.receipt_path.as_ref() {
(
path.clone(),
crate::tools::review::read_review_receipt(path)
.with_context(|| format!("failed to read review receipt {}", path.display()))?,
)View on GitHub (pinned to 73e0f67d83)