Hmbown/CodeWhale · error · PersistenceBacklogMeasurementError
exact library measurement test
Error message
exact library measurement test {TEST_NAME} emitted no valid receipt: {error} What it means
After the test run, the script reads the receipt JSON file the test is supposed to write and wraps any failure to find or parse it into PersistenceBacklogMeasurementError, chaining the underlying OSError or JSONDecodeError. It means the test ran but produced no readable, valid receipt.
Solutions
- Run the exact test (cargo test <TEST_NAME>) directly and check whether it writes the receipt and where
- Delete the stale/corrupt receipt and re-run so the test writes it fresh
- Fix filesystem issues: correct working directory, write permissions, free disk space
- If the JSON is malformed, fix the test's receipt-serialization code
Example fix
// before (read)
receipt_path = Path("receipt.json") # stale from previous run
// after
receipt_path.unlink(missing_ok=True) # then re-run so the test writes a fresh receipt Defensive patterns
Strategy: try-catch
Validate before calling
receipt = Path("receipt.json")
receipt.unlink(missing_ok=True)
# after running the test:
assert receipt.exists() and receipt.stat().st_size > 0
json.loads(receipt.read_text(encoding="utf-8")) Try / catch
try:
receipt = run_measurement()
except PersistenceBacklogMeasurementError as e:
log.error("measurement receipt missing/invalid: %s", e) Prevention
- Delete stale receipts before each measurement run
- Run the script from its expected working directory
- Validate the receipt JSON schema in the test itself before writing
When it happens
Trigger: The receipt file was not written (test didn't reach the write, wrong cwd, no permission), the path is stale, or the file contains invalid/truncated JSON.
Common situations: Test failed mid-run after the harness reported started; running the script from a different working directory than the receipt path expects; a previous crash left a corrupt receipt; disk-full or permission issues.
Understand the failure class
Background: "Invalid JSON response" and "Failed to parse response" errors: when an API answers 200 but the body isn't the JSON your library expected — this error's family across 28 libraries.
Related errors
- Cannot parse portable data; use JSON for OpenCode or plain…
- Cargo metadata is not valid JSON
- Cargo metadata must contain workspace_members and packages…
- Cargo metadata root must be an object
- exact library measurement test
AI-assisted analysis of Hmbown/CodeWhale@433685b202 (2026-09-15).
Data as JSON: /api/errors/8e3b872bf2d98fdb.
Report an issue: GitHub.
Appendix: source
Thrown at scripts/measure-persistence-backlog.py:77
text=True,
capture_output=True,
check=False,
)
sys.stderr.write(result.stderr)
if result.returncode != 0:
sys.stdout.write(result.stdout)
result.check_returncode()
combined = "\n".join(result.stdout.splitlines() + result.stderr.splitlines())
if re.search(r"\brunning\s+0\s+tests?\b", combined):
sys.stdout.write(result.stdout)
raise PersistenceBacklogMeasurementError(
f"exact library measurement test {TEST_NAME} ran zero tests"
)
try:
return json.loads(receipt_path.read_text(encoding="utf-8"))
except (OSError, json.JSONDecodeError) as error:
raise PersistenceBacklogMeasurementError(
f"exact library measurement test {TEST_NAME} emitted no valid receipt: {error}"
) from error
def main() -> int:
source_sha = subprocess.run(
["git", "rev-parse", "HEAD"],
cwd=ROOT,
text=True,
capture_output=True,
check=True,
).stdout.strip()
source_dirty = bool(
subprocess.run(
["git", "status", "--porcelain", "--untracked-files=normal"],
cwd=ROOT,
text=True,
capture_output=True,View on GitHub (pinned to 433685b202)