Hmbown/CodeWhale · error · anyhow::Error
--receipt-path requires --write-receipt or --check-receipt
Error message
--receipt-path requires --write-receipt or --check-receipt
What it means
validate_review_receipt_args() enforces flag dependencies: `--receipt-path` only means something when the run either writes a receipt (`--write-receipt`) or verifies one (`--check-receipt`). Passing the path alone is rejected in run_review() before any diff collection or model call.
Source
Thrown at crates/tui/src/lib.rs:8055
}
if let Some(error) = review_error {
anyhow::bail!(error);
}
}
Ok(())
}
fn resolve_review_model(config: &Config, explicit_model: Option<&str>) -> String {
explicit_model
.map(str::trim)
.filter(|model| !model.is_empty())
.map(str::to_string)
.unwrap_or_else(|| config.default_model())
}
fn validate_review_receipt_args(args: &ReviewArgs) -> Result<()> {
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."View on GitHub (pinned to 0c42157ee5)
Solutions
- Writing a receipt: add `--write-receipt`
- Verifying a receipt: add `--check-receipt`
- If you did not want receipt behavior, drop `--receipt-path` entirely
Example fix
// before $ codewhale review --receipt-path out.json Error: --receipt-path requires --write-receipt or --check-receipt // after $ codewhale review --write-receipt --receipt-path out.json
Defensive patterns
Strategy: validation
Validate before calling
[ -z "$RECEIPT_PATH" ] || [ -n "$WRITE_RECEIPT$CHECK_RECEIPT" ] || { echo '--receipt-path needs --write-receipt or --check-receipt' >&2; exit 2; } Prevention
- Model receipt flows as two fixed invocations (write step, check step) in scripts
- Reject orphan flags at the wrapper boundary
When it happens
Trigger: `codewhale review --receipt-path <file>` with neither `--write-receipt` nor `--check-receipt` set.
Common situations: Splitting a receipt workflow into steps and forgetting which step carries which flag; leftover flags pasted from a longer command.
Related errors
- --write-receipt and --check-receipt are mutually exclusive
- DSH is not connected; nothing to remove
- Review receipt check failed: {}
- The Codewhale service returned an unexpectedly large respons
- Codewhale account login timed out; run `codewhale account lo
AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20).
Data as JSON: /api/errors/8c8106f5346628fb.
Report an issue: GitHub.