Hmbown/CodeWhale · error · PersistenceBacklogError
receipt must be a version string
Error message
receipt {field} must be a version string What it means
The `rustc_version` and `cargo_version` fields must be strings starting with the prefixes `"rustc "` and `"cargo "` respectively, mirroring the raw first line of `rustc --version` / `cargo --version`. The validator uses these to pin the receipt to the exact toolchain that produced the measurement. A missing toolchain identifier or a value that does not carry the expected prefix fails this check.
Solutions
- Store the full first line of `rustc --version`, e.g. `"rustc 1.75.0 (82e1608df 2023-12-21)"`
- Store the full first line of `cargo --version`, e.g. `"cargo 1.75.0 (1d8b05cdd 2023-11-20)"`
- Regenerate the receipt so `current_source_identity()` fills these fields from the actual toolchain
Example fix
// before "rustc_version": "1.75.0", "cargo_version": "1.75.0" // after "rustc_version": "rustc 1.75.0 (82e1608df 2023-12-21)", "cargo_version": "cargo 1.75.0 (1d8b05cdd 2023-11-20)"
Defensive patterns
Strategy: validation
Validate before calling
assert str(receipt.get("rustc_version", "")).startswith("rustc "), receipt.get("rustc_version")
assert str(receipt.get("cargo_version", "")).startswith("cargo "), receipt.get("cargo_version") Type guard
def has_toolchain_strings(r):
return isinstance(r, dict) and isinstance(r.get("rustc_version"), str) and r["rustc_version"].startswith("rustc ") and isinstance(r.get("cargo_version"), str) and r["cargo_version"].startswith("cargo ") Try / catch
try:
validate_receipt(receipt)
except PersistenceBacklogError as e:
if "must be a version string" in str(e):
fill_versions_from_subprocess(receipt) # rustc --version / cargo --version Prevention
- Store the raw first line of `rustc --version` and `cargo --version` verbatim
- Never strip the "rustc "/"cargo " prefix to save space
- Capture toolchain versions in the same run as the measurement
When it happens
Trigger: A hand-written receipt stores just `"1.75.0"` or `"rustc"` without the prefix; the field is null or a number; the value was captured from a different command whose output lacks the prefix.
Common situations: Receipts authored by hand or by a script that reformatted the version output; recording only the version number instead of the full `rustc 1.75.0 (...)` line; generating receipts on a machine where the toolchain string is localized or wrapped.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- receipt source_sha must be an exact lowercase Git SHA
- baseline provenance needs
- CRON field contains an empty list item
- custom provider name may only use letters, numbers, '-' and…
- fleet must be a simple ASCII token no longer than bytes
AI-assisted analysis of Hmbown/CodeWhale@433685b202 (2026-09-15).
Data as JSON: /api/errors/d93040f3c9fcb84c.
Report an issue: GitHub.
Appendix: source
Thrown at scripts/check-persistence-backlog-budget.py:161
if missing:
raise PersistenceBacklogError(
"receipt missing required field(s): " + ", ".join(missing)
)
if receipt["document_kind"] != RECEIPT_KIND:
raise PersistenceBacklogError(f"receipt document_kind must be {RECEIPT_KIND}")
if receipt["schema_version"] != SCHEMA_VERSION:
raise PersistenceBacklogError("receipt schema_version changed")
for field, expected in FIXTURE.items():
validate_frozen_field(field, receipt[field], expected)
if not isinstance(receipt["source_sha"], str) or not SOURCE_SHA_PATTERN.fullmatch(
receipt["source_sha"]
):
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"]View on GitHub (pinned to 433685b202)