{"record":{"id":"40b4b65695fbd1ac","repo":"nexu-io/open-design","slug":"running-left-mirrored-output-is-missing-output","errorCode":null,"errorMessage":"running-left mirrored output is missing: {output}","messagePattern":"running-left mirrored output is missing: (.+?)","errorType":"exception","errorClass":"SystemExit","httpStatus":null,"severity":"error","filePath":"skills/hatch-pet/scripts/finalize_pet_run.py","lineNumber":102,"sourceCode":"    if job.get(\"derived_from\") != \"running-right\":\n        raise SystemExit(\"running-left mirror job must derive from running-right\")\n    decision = job.get(\"mirror_decision\")\n    if not isinstance(decision, dict) or decision.get(\"approved\") is not True:\n        raise SystemExit(\n            \"running-left mirror job is missing an approved mirror_decision; \"\n            \"use derive_running_left_from_running_right.py after visual review\"\n        )\n\n    expected_source_hash = job.get(\"source_sha256\")\n    expected_output_hash = job.get(\"output_sha256\")\n    if not isinstance(expected_source_hash, str) or not expected_source_hash:\n        raise SystemExit(\"running-left mirror job is missing source_sha256\")\n    if not isinstance(expected_output_hash, str) or not expected_output_hash:\n        raise SystemExit(\"running-left mirror job is missing output_sha256\")\n    if not source.is_file():\n        raise SystemExit(f\"running-left mirror source image no longer exists: {source}\")\n    if not output.is_file():\n        raise SystemExit(f\"running-left mirrored output is missing: {output}\")\n    if source.name != \"running-right.png\" or source.parent.name != \"decoded\":\n        raise SystemExit(\"running-left mirror source must be decoded/running-right.png\")\n    if output.name != \"running-left.png\" or output.parent.name != \"decoded\":\n        raise SystemExit(\"running-left mirror output must be decoded/running-left.png\")\n    if file_sha256(source) != expected_source_hash:\n        raise SystemExit(\"running-left mirror source hash does not match imagegen-jobs.json\")\n    if file_sha256(output) != expected_output_hash:\n        raise SystemExit(\n            \"running-left mirrored output hash does not match imagegen-jobs.json; \"\n            \"rerun derive_running_left_from_running_right.py\"\n        )\n    with Image.open(source) as source_image, Image.open(output) as output_image:\n        expected = ImageOps.mirror(source_image.convert(\"RGBA\"))\n        actual = output_image.convert(\"RGBA\")\n        if expected.size != actual.size or expected.tobytes() != actual.tobytes():\n            raise SystemExit(\n                \"running-left mirrored output is not an exact horizontal mirror of running-right\"\n            )","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/nexu-io/open-design/blob/5be4028344c2eb4c667c5a97bda8f750c5597ef7/skills/hatch-pet/scripts/finalize_pet_run.py#L84-L120","documentation":"Raised by validate_mirror_hash in finalize_pet_run.py after the running-left mirror job passed source/hash checks but the resolved output_path does not exist on disk. The deterministic-mirror provenance path requires a real decoded/running-left.png produced by derive_running_left_from_running_right.py, and finalize refuses to proceed without it.","triggerScenarios":"A job whose source_provenance == 'deterministic-mirror' and job_id == 'running-left', where the on-disk file at job['output_path'] (resolved under run_dir) is missing, deleted, or never written by the derive script.","commonSituations":"Running finalize_pet_run.py before derive_running_left_from_running_right.py; someone manually deleted decoded/running-left.png; the output_path in imagegen-jobs.json points at a stale or renamed location after a cleanup of the decoded directory.","solutions":["Run skills/hatch-pet/scripts/derive_running_left_from_running_right.py --run-dir <run_dir> to regenerate decoded/running-left.png from running-right.png.","Inspect imagegen-jobs.json for the running-left job's output_path and confirm it resolves to <run_dir>/decoded/running-left.png.","Re-run pet_job_status.py to confirm the running-left job is marked complete, then re-invoke finalize_pet_run.py."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"from pathlib import Path\nrun_dir = Path('run')\noutput = (run_dir / job['output_path']).resolve()\nif not output.is_file():\n    raise RuntimeError(f'running-left output missing; run derive_running_left_from_running_right.py first: {output}')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always run derive_running_left_from_running_right.py before finalize_pet_run.py so decoded/running-left.png exists.","Treat imagegen-jobs.json's output_path as the source of truth; do not move decoded files manually.","Before finalize, assert every job's output_path resolves to an existing file."],"tags":["filesystem","mirror","validation","pet-pipeline"],"backgroundTag":null,"analyzedSha":"5be4028344c2eb4c667c5a97bda8f750c5597ef7","analyzedAt":"2026-08-12T12:03:58.812Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}