nexu-io/open-design · error · SystemExit

running-left mirror job is missing source_sha256

Error message

running-left mirror job is missing source_sha256

What it means

The mirror job must record source_sha256 (the hash of decoded/running-right.png) so finalize can re-verify the mirror's lineage. A missing source_sha256 means the derive step did not complete its bookkeeping.

Source

Thrown at skills/hatch-pet/scripts/finalize_pet_run.py:96

        )


def validate_mirror_hash(job: dict[str, object], *, source: Path, output: Path, job_id: str) -> None:
    if job_id != "running-left":
        raise SystemExit(f"job {job_id} may not use deterministic mirror provenance")
    if job.get("derived_from") != "running-right":
        raise SystemExit("running-left mirror job must derive from running-right")
    decision = job.get("mirror_decision")
    if not isinstance(decision, dict) or decision.get("approved") is not True:
        raise SystemExit(
            "running-left mirror job is missing an approved mirror_decision; "
            "use derive_running_left_from_running_right.py after visual review"
        )

    expected_source_hash = job.get("source_sha256")
    expected_output_hash = job.get("output_sha256")
    if not isinstance(expected_source_hash, str) or not expected_source_hash:
        raise SystemExit("running-left mirror job is missing source_sha256")
    if not isinstance(expected_output_hash, str) or not expected_output_hash:
        raise SystemExit("running-left mirror job is missing output_sha256")
    if not source.is_file():
        raise SystemExit(f"running-left mirror source image no longer exists: {source}")
    if not output.is_file():
        raise SystemExit(f"running-left mirrored output is missing: {output}")
    if source.name != "running-right.png" or source.parent.name != "decoded":
        raise SystemExit("running-left mirror source must be decoded/running-right.png")
    if output.name != "running-left.png" or output.parent.name != "decoded":
        raise SystemExit("running-left mirror output must be decoded/running-left.png")
    if file_sha256(source) != expected_source_hash:
        raise SystemExit("running-left mirror source hash does not match imagegen-jobs.json")
    if file_sha256(output) != expected_output_hash:
        raise SystemExit(
            "running-left mirrored output hash does not match imagegen-jobs.json; "
            "rerun derive_running_left_from_running_right.py"
        )
    with Image.open(source) as source_image, Image.open(output) as output_image:

View on GitHub (pinned to 5be4028344)

Solutions

  1. Re-run derive_running_left_from_running_right.py (it writes source_sha256, output_sha256, and mirror_decision together).
  2. Do not hand-write the hash; it must match running-right.png on disk.
  3. Re-run finalize_pet_run.py.
Defensive patterns

Strategy: type-guard

Validate before calling

import json
from pathlib import Path

manifest = json.loads(Path("<run_dir>/imagegen-jobs.json").read_text())
left = next(j for j in manifest["jobs"] if j.get("id") == "running-left")
if left.get("source_provenance") == "deterministic-mirror":
    assert isinstance(left.get("source_sha256"), str) and left["source_sha256"], \
        "running-left mirror missing source_sha256 — re-run derive_running_left_from_running_right.py"

Type guard

def mirror_source_hash_ok(left_job: dict) -> bool:
    if left_job.get("source_provenance") != "deterministic-mirror":
        return True
    return isinstance(left_job.get("source_sha256"), str) and bool(left_job["source_sha256"])

Prevention

When it happens

Trigger: running-left has source_provenance deterministic-mirror but source_sha256 is missing or not a string — e.g. the derive script was killed mid-write before it recorded the hash.

Common situations: Interrupted derive run; hand-editing that dropped the field; a manifest from a partial run.

Related errors


AI-assisted analysis of nexu-io/open-design@5be4028344 (2026-08-12). Data as JSON: /api/errors/297cc5fdeddf1426. Report an issue: GitHub.