{"record":{"id":"e6b7246df6121a02","repo":"Hmbown/CodeWhale","slug":"review-receipt-check-failed","errorCode":null,"errorMessage":"Review receipt check failed: {}","messagePattern":"Review receipt check failed: (.+?)","errorType":"error_code","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/lib.rs","lineNumber":9136,"sourceCode":"        validation.reason =\n            \"review receipt does not match the current PR base/head revision\".into();\n    }\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());\n    }\n\n    if !validation.passed {\n        bail!(\"Review receipt check failed: {}\", validation.reason);\n    }\n    Ok(())\n}\n\nfn review_receipt_validation_public_json(\n    validation: &crate::tools::review::ReviewReceiptValidation,\n) -> serde_json::Value {\n    let unresolved_risk = validation.unresolved_risk.as_ref();\n    serde_json::json!({\n        \"passed\": validation.passed,\n        \"status\": review_receipt_validation_status(validation),\n        \"diff_fingerprint\": validation.diff_fingerprint.as_str(),\n        \"receipt_fingerprint\": validation.receipt_fingerprint.as_deref(),\n        \"unresolved\": unresolved_risk.is_some_and(|risk| risk.unresolved),\n        \"risk_level\": unresolved_risk.map(|risk| risk.level.as_str()),\n    })\n}\n","sourceCodeStart":9118,"sourceCodeEnd":9154,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/lib.rs#L9118-L9154","documentation":"A receipt validation performed with --check-receipt did not pass: ReviewReceiptValidation.passed was false and validation.reason explains why. The command bails so CI/automation sees a non-zero exit when the receipt does not match the review it claims to certify.","triggerScenarios":"Running `codewhale review --check-receipt --receipt-path <file>` where the receipt's contents fail validation (validation.reason carries the specific mismatch).","commonSituations":"Checking a receipt generated from an older code version against a new review; a receipt file that was edited or belongs to a different PR; tamper/integrity verification failing in CI.","solutions":["Read the `{}` reason in the message for the specific validation failure","Re-run the review with --write-receipt to generate a fresh, matching receipt","Verify you are checking the receipt file that corresponds to this exact review/PR"],"exampleFix":"// before\ncodewhale review --pr 123 --check-receipt --receipt-path stale.json\n// after\ncodewhale review --pr 123 --write-receipt --receipt-path receipt.json","handlingStrategy":"try-catch","validationCode":"// pre-check the receipt file exists and is well-formed JSON before --check-receipt\nconst fs = require('fs');\nconst receipt = JSON.parse(fs.readFileSync(path, 'utf8'));\nif (!receipt || !receipt.review) throw new Error(\"malformed receipt file\");","typeGuard":null,"tryCatchPattern":"match on `codewhale review --check-receipt` exit; on failure, log the reason embedded in \"Review receipt check failed: {reason}\" and regenerate the receipt with --write-receipt","preventionTips":["Never hand-edit receipt files; regenerate them","Keep receipts next to the review run artifacts they certify","Fail the pipeline on this error rather than ignoring it — it is the integrity gate"],"tags":["cli","receipt","validation","integrity"],"backgroundTag":"schema-validation-failed","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"}