Hmbown/CodeWhale · error · anyhow::Error

--write-receipt and --check-receipt are mutually exclusive

Error message

--write-receipt and --check-receipt are mutually exclusive

What it means

The second rule in validate_review_receipt_args(): `--write-receipt` and `--check-receipt` select mutually exclusive modes (produce a receipt vs verify one) and cannot be combined in a single `codewhale review` run.

Source

Thrown at crates/tui/src/lib.rs:8058

        }
    }
    Ok(())
}

fn resolve_review_model(config: &Config, explicit_model: Option<&str>) -> String {
    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");
    }
    Ok(())
}

fn run_review_receipt_check(diff: &str, args: &ReviewArgs) -> 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()))?,
        )
    } else {
        crate::tools::review::latest_review_receipt_for_diff(diff)?.ok_or_else(|| {
            anyhow!(
                "No review receipt found for the current diff. Run `codewhale review --write-receipt` first, or pass --receipt-path."
            )
        })?
    };

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Split into two runs: first `--write-receipt`, then `--check-receipt` (both may share `--receipt-path`)
  2. Remove whichever mode you do not want in this run

Example fix

// before
$ codewhale review --write-receipt --check-receipt
Error: --write-receipt and --check-receipt are mutually exclusive

// after
$ codewhale review --write-receipt --receipt-path r.json
$ codewhale review --check-receipt  --receipt-path r.json
Defensive patterns

Strategy: validation

Validate before calling

[ -z "$WRITE_RECEIPT" ] || [ -z "$CHECK_RECEIPT" ] || { echo 'pick one of --write-receipt / --check-receipt' >&2; exit 2; }

Prevention

When it happens

Trigger: `codewhale review --write-receipt --check-receipt` in one invocation.

Common situations: Copy-pasting a "full receipt workflow" one-liner; wrappers appending mode flags cumulatively.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20). Data as JSON: /api/errors/534491856107deaa. Report an issue: GitHub.