Hmbown/CodeWhale · error · PersistenceBacklogError
source provenance command failed: {' '.join(command)}
Error message
source provenance command failed: {' '.join(command)} What it means
Raised in current_source_identity (scripts/check-persistence-backlog-budget.py:118-121) when one of the provenance commands — git rev-parse HEAD, git status --porcelain --untracked-files=normal, rustc --version, cargo --version — exits non-zero. The checker captures the current toolchain and commit identity to pin receipts to the exact source that produced them, so the environment must have a working git repository and Rust toolchain before validation starts.
Source
Thrown at scripts/check-persistence-backlog-budget.py:119
def validate_frozen_field(field: str, value: Any, expected: Any) -> None:
if type(value) is not type(expected) or value != expected:
raise PersistenceBacklogError(
f"receipt {field} must remain {expected!r}, got {value!r}"
)
def current_source_identity() -> dict[str, Any]:
def run(command: list[str]) -> str:
result = subprocess.run(
command,
cwd=ROOT,
text=True,
capture_output=True,
check=False,
)
if result.returncode != 0:
raise PersistenceBacklogError(
f"source provenance command failed: {' '.join(command)}"
)
return result.stdout.strip()
return {
"source_sha": run(["git", "rev-parse", "HEAD"]),
"source_dirty": bool(
run(["git", "status", "--porcelain", "--untracked-files=normal"])
),
"rustc_version": run(["rustc", "--version"]),
"cargo_version": run(["cargo", "--version"]),
"build_profile": "test",
"sample_count": 1,
}
def validate_receipt(
receipt: dict[str, Any],View on GitHub (pinned to 8880682c63)
Solutions
- Run from a full git clone and confirm `git rev-parse HEAD` succeeds in the repo root.
- Install/activate the Rust toolchain (rustup default stable) so `rustc --version` and `cargo --version` work in the same shell.
- If the repo has no commits yet, create one before running the budget check.
- In containers, mount or clone the repository instead of copying a gitless source tree.
Example fix
# before (gitless export) cd codewhale-src-export && python scripts/check-persistence-backlog-budget.py # after (full clone) git clone <repo> codewhale && cd codewhale && python scripts/check-persistence-backlog-budget.py
Defensive patterns
Strategy: validation
Validate before calling
import shutil, subprocess
for tool in ("git", "rustc", "cargo"):
if shutil.which(tool) is None:
sys.exit(f"missing {tool} on PATH; fix the environment before checking the budget")
if subprocess.run(["git", "rev-parse", "HEAD"], cwd=ROOT, capture_output=True).returncode != 0:
sys.exit("not a git repo with commits; clone the full repository first") Try / catch
try:
identity = current_source_identity()
except PersistenceBacklogError as e:
if "provenance command failed" in str(e):
print("environment lacks git/rustc/cargo; run from a full clone with a Rust toolchain")
raise Prevention
- Run the gate only from a full git clone with rustup-managed toolchain on PATH.
- In CI/containers, verify git and the Rust toolchain are installed before invoking the checker.
- Prefer `git clean -xfd` over exporting source trees without .git.
When it happens
Trigger: Running the script outside a git repository (ROOT resolved from a tarball/source export); a freshly `git init`-ed repo with no commits (rev-parse HEAD fails on unborn branch); git, rustc, or cargo not on PATH; a corrupted .git directory.
Common situations: CI images that strip git; Docker containers with source COPYed in without .git; rustup not sourced in a non-login shell; running from an extracted release archive.
Related errors
- receipt source_sha must be an exact lowercase Git SHA
- receipt {field} must be a version string
- receipt {field} does not match the checked source
- persistence measurement source tree is dirty
- baseline provenance needs an exact source SHA
AI-assisted analysis of Hmbown/CodeWhale@8880682c63 (2026-08-16).
Data as JSON: /api/errors/36d81fdea551ee77.
Report an issue: GitHub.