{"record":{"id":"534491856107deaa","repo":"Hmbown/CodeWhale","slug":"write-receipt-and-check-receipt-are-mutually-e","errorCode":null,"errorMessage":"--write-receipt and --check-receipt are mutually exclusive","messagePattern":"--write-receipt and --check-receipt are mutually exclusive","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/lib.rs","lineNumber":8058,"sourceCode":"        }\n    }\n    Ok(())\n}\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    Ok(())\n}\n\nfn run_review_receipt_check(diff: &str, args: &ReviewArgs) -> 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        )\n    } else {\n        crate::tools::review::latest_review_receipt_for_diff(diff)?.ok_or_else(|| {\n            anyhow!(\n                \"No review receipt found for the current diff. Run `codewhale review --write-receipt` first, or pass --receipt-path.\"\n            )\n        })?\n    };","sourceCodeStart":8040,"sourceCodeEnd":8076,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/lib.rs#L8040-L8076","documentation":"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.","triggerScenarios":"`codewhale review --write-receipt --check-receipt` in one invocation.","commonSituations":"Copy-pasting a \"full receipt workflow\" one-liner; wrappers appending mode flags cumulatively.","solutions":["Split into two runs: first `--write-receipt`, then `--check-receipt` (both may share `--receipt-path`)","Remove whichever mode you do not want in this run"],"exampleFix":"// before\n$ codewhale review --write-receipt --check-receipt\nError: --write-receipt and --check-receipt are mutually exclusive\n\n// after\n$ codewhale review --write-receipt --receipt-path r.json\n$ codewhale review --check-receipt  --receipt-path r.json","handlingStrategy":"validation","validationCode":"[ -z \"$WRITE_RECEIPT\" ] || [ -z \"$CHECK_RECEIPT\" ] || { echo 'pick one of --write-receipt / --check-receipt' >&2; exit 2; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Encode the write-then-check sequence as two script steps, never one command","Keep mode flags in per-step variables so they cannot accumulate"],"tags":["review","receipt","cli","mutually-exclusive-flags"],"backgroundTag":"mutually-exclusive-flags","analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}