Hmbown/CodeWhale · error · RuntimeContractError
receipt and budget must resolve to distinct filesystem paths
Error message
receipt and budget must resolve to distinct filesystem paths
What it means
check-runtime-contract-budget.py validates that runtime contract fragment sizes stay within a recorded budget. This error is thrown when the --receipt and --budget CLI flags point at the same resolved path, which would make the tool both read the budget from and write the receipt to the same file, corrupting the comparison.
Solutions
- Pass two distinct file paths to --receipt and --budget
- Check for symlinks or '..' components that make different-looking paths resolve to one file
- If you only have one file, split it: keep the budget file immutable and write the receipt to a new path
Example fix
// before python scripts/check-runtime-contract-budget.py --budget state/budget.json --receipt state/budget.json // after python scripts/check-runtime-contract-budget.py --budget state/budget.json --receipt state/receipt.json
Defensive patterns
Strategy: validation
Validate before calling
from pathlib import Path receipt, budget = Path(args.receipt), Path(args.budget) assert receipt.exists() and budget.exists() assert receipt.resolve() != budget.resolve(), "receipt and budget must differ"
Prevention
- Keep budget files immutable and receipts in a separate directory
- Use absolute paths in scripts to avoid resolution surprises
When it happens
Trigger: Invoking the script with the same path (or paths that resolve to the same file, e.g. via symlink or relative vs absolute spelling) for --receipt and --budget.
Common situations: Copy-pasting a single path into both CLI flags; using '.'-style or symlinked paths that resolve to one file; shell scripts passing the same variable to both options.
Understand the failure class
Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.
Related errors
- account_agent_model_unconfigured
- bundle at is bytes; the limit is bytes
- bundle at is bytes; the limit is bytes
- cannot resolve the current Codewhale route
- config export requires --portable; plain export is not…
AI-assisted analysis of Hmbown/CodeWhale@433685b202 (2026-09-15).
Data as JSON: /api/errors/362646183380008b.
Report an issue: GitHub.
Appendix: source
Thrown at scripts/check-runtime-contract-budget.py:642
help="check an existing measurement JSON instead of compiling",
)
parser.add_argument(
"--budget",
type=Path,
default=BUDGET_PATH,
help=argparse.SUPPRESS,
)
parser.add_argument(
"--update",
action="store_true",
help="tighten all ceilings to the current receipt; refuses increases",
)
args = parser.parse_args(argv)
try:
check_fragment_caps()
if args.receipt is not None and args.receipt.resolve() == args.budget.resolve():
raise RuntimeContractError(
"receipt and budget must resolve to distinct filesystem paths"
)
budget = load_json(args.budget, "budget")
receipt = (
load_json(args.receipt, "receipt")
if args.receipt is not None
else run_measurement()
)
increases, decreases = compare(receipt, budget)
except RuntimeContractError as error:
print(f"[runtime-contract-budget] ERROR: {error}", file=sys.stderr)
return 2
if increases:
print("[runtime-contract-budget] FAIL: runtime contract grew:", file=sys.stderr)
for path, label, current, ceiling in increases:
print(
f" {label}: {current} > {ceiling} (+{current - ceiling}) [{path}]",View on GitHub (pinned to 433685b202)