{"record":{"id":"4b894e284f617040","repo":"Hmbown/CodeWhale","slug":"no-review-receipt-found-for-the-current-diff-run","errorCode":null,"errorMessage":"No review receipt found for the current diff. Run `codewhale review --write-receipt` first, or pass --receipt-path.","messagePattern":"No review receipt found for the current diff\\. Run `codewhale review --write-receipt` first, or pass --receipt-path\\.","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"warning","filePath":"crates/tui/src/lib.rs","lineNumber":7968,"sourceCode":"    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    };\n    let validation =\n        crate::tools::review::validate_review_receipt_for_diff(diff, &receipt, Some(path.clone()));\n\n    if args.json {\n        println!(\n            \"{}\",\n            serde_json::to_string_pretty(&serde_json::json!({\n                \"mode\": \"review_receipt_check\",\n                \"success\": validation.passed,\n                \"validation\": review_receipt_validation_public_json(&validation),\n            }))?\n        );\n    } else if validation.passed {\n        println!(\"Review receipt valid: {}\", path.display());","sourceCodeStart":7950,"sourceCodeEnd":7986,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/8880682c63083a91624de936797efa3ce9e498fd/crates/tui/src/lib.rs#L7950-L7986","documentation":"codewhale review --check-receipt without --receipt-path looks up a stored review receipt whose hash matches the current diff via latest_review_receipt_for_diff. If no receipt matches, the check stops with this message directing you to run --write-receipt first or pass --receipt-path.","triggerScenarios":"Running --check-receipt on a diff that was never reviewed with --write-receipt; the diff changed after the receipt was written so its hash no longer matches; receipt storage was cleaned; running in a different workspace than where the receipt was written.","commonSituations":"CI enforcing receipt checks on PRs where the author never ran the write step; amending or rebasing commits after review so the diff hash shifts; receipt files removed by clean or cache steps.","solutions":["Run codewhale review --write-receipt on the exact current diff, then rerun --check-receipt","If a receipt exists at a custom location, pass --receipt-path <path>","Keep the diff byte-identical between the write and check steps — no rebases or amends in between","In CI, require the write step before the check step so the receipt always exists"],"exampleFix":"# before\ncodewhale review --check-receipt\n\n# after\ncodewhale review --write-receipt && codewhale review --check-receipt","handlingStrategy":"validation","validationCode":"// Before the check step, confirm a receipt exists for the exact diff\nif crate::tools::review::latest_review_receipt_for_diff(&diff)?.is_none() {\n    eprintln!(\"no receipt for this diff; run `codewhale review --write-receipt` first\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pair --write-receipt with --check-receipt in workflows","Do not amend or rebase the diff between the write and check steps","Pass --receipt-path when receipts live outside the default location","Make CI require the write step before the check step"],"tags":["rust","cli","review","receipts","ci"],"backgroundTag":null,"analyzedSha":"8880682c63083a91624de936797efa3ce9e498fd","analyzedAt":"2026-08-16T11:31:27.956Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}