Hmbown/CodeWhale · warning · anyhow::Error

No review receipt found for the current diff. Run `codewhale

Error message

No review receipt found for the current diff. Run `codewhale review --write-receipt` first, or pass --receipt-path.

What it means

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.

Source

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

    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."
            )
        })?
    };
    let validation =
        crate::tools::review::validate_review_receipt_for_diff(diff, &receipt, Some(path.clone()));

    if args.json {
        println!(
            "{}",
            serde_json::to_string_pretty(&serde_json::json!({
                "mode": "review_receipt_check",
                "success": validation.passed,
                "validation": review_receipt_validation_public_json(&validation),
            }))?
        );
    } else if validation.passed {
        println!("Review receipt valid: {}", path.display());

View on GitHub (pinned to 8880682c63)

Solutions

  1. Run codewhale review --write-receipt on the exact current diff, then rerun --check-receipt
  2. If a receipt exists at a custom location, pass --receipt-path <path>
  3. Keep the diff byte-identical between the write and check steps — no rebases or amends in between
  4. In CI, require the write step before the check step so the receipt always exists

Example fix

# before
codewhale review --check-receipt

# after
codewhale review --write-receipt && codewhale review --check-receipt
Defensive patterns

Strategy: validation

Validate before calling

// Before the check step, confirm a receipt exists for the exact diff
if crate::tools::review::latest_review_receipt_for_diff(&diff)?.is_none() {
    eprintln!("no receipt for this diff; run `codewhale review --write-receipt` first");
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@8880682c63 (2026-08-16). Data as JSON: /api/errors/4b894e284f617040. Report an issue: GitHub.