Hmbown/CodeWhale · error · PersistenceBacklogError
receipt does not match the checked source
Error message
receipt {field} does not match the checked source What it means
When `validate_receipt` is called with `expected_source` (as `compare()` does via main), each provenance field of the receipt — source_sha, source_dirty, rustc_version, cargo_version, build_profile, sample_count — must exactly equal the value captured from the current machine by `current_source_identity()`. This error means the receipt was measured under different conditions (different commit, dirty state, or toolchain) than the tree being checked, so its numbers cannot be compared against the budget for this source.
Solutions
- Re-run the measurement (`python scripts/check-persistence-backlog-budget.py` without --receipt) on the current tree to produce a fresh receipt
- Commit or stash local changes so the source state matches the receipt's source_dirty/source_sha
- Regenerate the receipt after any rustc/cargo version change so toolchain fields match
- Align the checkout to the commit recorded in the receipt with `git checkout <source_sha>` if re-measuring is not an option
Example fix
// before (receipt from old commit) $ python scripts/check-persistence-backlog-budget.py --receipt old-receipt.json ERROR: receipt source_sha does not match the checked source // after (fresh measurement on current HEAD) $ python scripts/check-persistence-backlog-budget.py PASS: one-way ceilings respected
Defensive patterns
Strategy: validation
Validate before calling
def matches_current_source(receipt, expected):
return all(receipt.get(f) == expected.get(f) for f in ("source_sha","source_dirty","rustc_version","cargo_version","build_profile","sample_count")) Try / catch
try:
compare(receipt, budget, expected_source=expected)
except PersistenceBacklogError as e:
if "does not match the checked source" in str(e):
receipt = re_measure_current_tree() Prevention
- Re-measure rather than reusing receipts after any commit, edit, or toolchain upgrade
- Run the check immediately after measurement on the same machine
- Never copy receipts between checkouts or machines
- Watch for rustup auto-updates between measurement and check
When it happens
Trigger: Running the checker with `--receipt` for a receipt generated on another commit, after making local edits (dirty flag flips), or after upgrading rustc/cargo; copying a receipt from a teammate or CI into a different checkout.
Common situations: Checking a stale committed receipt against a moved HEAD; a rustup toolchain update between measurement and check; uncommitted changes making source_dirty true while the receipt says false.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- baseline provenance must identify a clean source tree
- baseline provenance needs an exact source SHA
- receipt source_sha must be an exact lowercase Git SHA
- baseline_observation needs provenance
- baseline provenance build profile/sample count changed
AI-assisted analysis of Hmbown/CodeWhale@433685b202 (2026-09-15).
Data as JSON: /api/errors/408b844efa8b7c1b.
Report an issue: GitHub.
Appendix: source
Thrown at scripts/check-persistence-backlog-budget.py:174
raise PersistenceBacklogError("receipt source_sha must be an exact lowercase Git SHA")
if type(receipt["source_dirty"]) is not bool:
raise PersistenceBacklogError("receipt source_dirty must be boolean")
for field, prefix in (("rustc_version", "rustc "), ("cargo_version", "cargo ")):
if not isinstance(receipt[field], str) or not receipt[field].startswith(prefix):
raise PersistenceBacklogError(f"receipt {field} must be a version string")
validate_frozen_field("build_profile", receipt["build_profile"], "test")
validate_frozen_field("sample_count", receipt["sample_count"], 1)
if expected_source is not None:
for field in (
"source_sha",
"source_dirty",
"rustc_version",
"cargo_version",
"build_profile",
"sample_count",
):
if receipt[field] != expected_source[field]:
raise PersistenceBacklogError(
f"receipt {field} does not match the checked source"
)
if require_clean_source and receipt["source_dirty"]:
raise PersistenceBacklogError("persistence measurement source tree is dirty")
platform = receipt["platform"]
if not isinstance(platform, str) or platform not in SUPPORTED_PLATFORMS:
raise PersistenceBacklogError("receipt platform is unsupported")
attempted = non_negative_integer(receipt["requests_attempted"], "requests_attempted")
accepted = non_negative_integer(receipt["accepted_requests"], "accepted_requests")
if accepted != attempted:
raise PersistenceBacklogError(
"accepted_requests must equal requests_attempted; sender rejection is not backlog improvement"
)
retained = non_negative_integer(
receipt["retained_queued_requests"], "retained_queued_requests"
)
if retained > accepted:View on GitHub (pinned to 433685b202)