{"record":{"id":"af34cbe2959a1ff6","repo":"nexu-io/open-design","slug":"job-job-id-source-image-no-longer-exists-sourc","errorCode":null,"errorMessage":"job {job_id} source image no longer exists: {source}","messagePattern":"job (.+?) source image no longer exists: (.+?)","errorType":"exception","errorClass":"SystemExit","httpStatus":null,"severity":"error","filePath":"skills/hatch-pet/scripts/finalize_pet_run.py","lineNumber":67,"sourceCode":"\ndef manifest_path(raw: object, *, run_dir: Path, field: str, job_id: str) -> Path:\n    if not isinstance(raw, str) or not raw:\n        raise SystemExit(f\"job {job_id} has no {field}\")\n    path = Path(raw).expanduser()\n    if not path.is_absolute():\n        path = run_dir / path\n    return path.resolve()\n\n\ndef validate_hash(job: dict[str, object], *, source: Path, output: Path, job_id: str) -> None:\n    expected_hash = job.get(\"source_sha256\")\n    if not isinstance(expected_hash, str) or not expected_hash:\n        raise SystemExit(\n            f\"job {job_id} is missing source_sha256; ingest visual outputs with \"\n            \"record_imagegen_result.py instead of editing imagegen-jobs.json\"\n        )\n    if not source.is_file():\n        raise SystemExit(f\"job {job_id} source image no longer exists: {source}\")\n    if not output.is_file():\n        raise SystemExit(f\"job {job_id} decoded output is missing: {output}\")\n    source_hash = file_sha256(source)\n    output_hash = file_sha256(output)\n    if source_hash != expected_hash:\n        raise SystemExit(f\"job {job_id} source image hash does not match imagegen-jobs.json\")\n    if output_hash != expected_hash:\n        raise SystemExit(\n            f\"job {job_id} decoded output does not match its recorded source image; \"\n            \"do not rewrite decoded visual outputs locally\"\n        )\n\n\ndef validate_mirror_hash(job: dict[str, object], *, source: Path, output: Path, job_id: str) -> None:\n    if job_id != \"running-left\":\n        raise SystemExit(f\"job {job_id} may not use deterministic mirror provenance\")\n    if job.get(\"derived_from\") != \"running-right\":\n        raise SystemExit(\"running-left mirror job must derive from running-right\")","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/nexu-io/open-design/blob/5be4028344c2eb4c667c5a97bda8f750c5597ef7/skills/hatch-pet/scripts/finalize_pet_run.py#L49-L85","documentation":"The job's source_path was recorded, but the source image file (the original ig_*.png under CODEX_HOME/generated_images) no longer exists on disk. finalize cannot re-hash it, so provenance cannot be confirmed.","triggerScenarios":"The recorded source file was deleted, moved, or CODEX_HOME changed so the absolute path now resolves to nothing.","commonSituations":"Garbage-collection of old generated images before finalize runs; switching machines or HOME; a temp/cleanup process removing generated_images entries.","solutions":["Check ls <source_path> and verify CODEX_HOME still points where the image was generated.","If the source was removed, regenerate it via $imagegen and re-ingest with record_imagegen_result.py to update the path and hash.","Keep generated_images intact until finalize completes."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import json, os\nfrom pathlib import Path\n\nrun_dir = Path(\"<run_dir>\")\nmanifest = json.loads((run_dir / \"imagegen-jobs.json\").read_text())\nfor job in manifest[\"jobs\"]:\n    src = job.get(\"source_path\")\n    if isinstance(src, str) and not Path(src).is_absolute():\n        src = run_dir / src\n    if job.get(\"status\") == \"complete\":\n        assert Path(src).is_file(), f\"source missing for {job.get('id')}: {src}\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Do not clean generated_images until finalize succeeds.","Keep CODEX_HOME stable across generate → ingest → finalize.","If you must move generated_images, re-ingest jobs to update source_path."],"tags":["hatch-pet","filesystem","missing-file","generated-images"],"backgroundTag":null,"analyzedSha":"5be4028344c2eb4c667c5a97bda8f750c5597ef7","analyzedAt":"2026-08-12T12:03:58.812Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}