{"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":"error_code","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/lib.rs","lineNumber":9079,"sourceCode":"\nfn non_empty_flag(value: Option<&str>) -> Option<&str> {\n    value.map(str::trim).filter(|value| !value.is_empty())\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    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<()> {","sourceCodeStart":9061,"sourceCodeEnd":9097,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/lib.rs#L9061-L9097","documentation":"CLI validation rejecting conflicting receipt modes: --write-receipt creates a new receipt while --check-receipt validates an existing one; performing both in a single invocation is ambiguous, so the combination is refused.","triggerScenarios":"Running `codewhale review ... --write-receipt --check-receipt` in the same command.","commonSituations":"Script templating that appends both flags unconditionally; confusing the write and check modes when chaining review runs.","solutions":["Keep only --write-receipt to produce a receipt","Keep only --check-receipt to validate an existing receipt","Split into two invocations: first check the old receipt, then write a new one"],"exampleFix":"// before\ncodewhale review --pr 123 --write-receipt --check-receipt --receipt-path r.json\n// after\ncodewhale review --pr 123 --check-receipt --receipt-path r.json","handlingStrategy":"validation","validationCode":"if (args.write_receipt && args.check_receipt) {\n  throw new Error(\"use --write-receipt or --check-receipt, not both\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pick one receipt mode per invocation; check then write in separate commands","Avoid templated flag lists that can accumulate both flags","Model receipt usage as write-once, check-after in scripts"],"tags":["cli","argument-validation","mutually-exclusive"],"backgroundTag":"mutually-exclusive-flags","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"}