nexu-io/open-design · error · SystemExit

job {job_id} source image no longer exists: {source}

Error message

job {job_id} source image no longer exists: {source}

What it means

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.

Source

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

def manifest_path(raw: object, *, run_dir: Path, field: str, job_id: str) -> Path:
    if not isinstance(raw, str) or not raw:
        raise SystemExit(f"job {job_id} has no {field}")
    path = Path(raw).expanduser()
    if not path.is_absolute():
        path = run_dir / path
    return path.resolve()


def validate_hash(job: dict[str, object], *, source: Path, output: Path, job_id: str) -> None:
    expected_hash = job.get("source_sha256")
    if not isinstance(expected_hash, str) or not expected_hash:
        raise SystemExit(
            f"job {job_id} is missing source_sha256; ingest visual outputs with "
            "record_imagegen_result.py instead of editing imagegen-jobs.json"
        )
    if not source.is_file():
        raise SystemExit(f"job {job_id} source image no longer exists: {source}")
    if not output.is_file():
        raise SystemExit(f"job {job_id} decoded output is missing: {output}")
    source_hash = file_sha256(source)
    output_hash = file_sha256(output)
    if source_hash != expected_hash:
        raise SystemExit(f"job {job_id} source image hash does not match imagegen-jobs.json")
    if output_hash != expected_hash:
        raise SystemExit(
            f"job {job_id} decoded output does not match its recorded source image; "
            "do not rewrite decoded visual outputs locally"
        )


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")

View on GitHub (pinned to 5be4028344)

Solutions

  1. Check ls <source_path> and verify CODEX_HOME still points where the image was generated.
  2. If the source was removed, regenerate it via $imagegen and re-ingest with record_imagegen_result.py to update the path and hash.
  3. Keep generated_images intact until finalize completes.
Defensive patterns

Strategy: validation

Validate before calling

import json, os
from pathlib import Path

run_dir = Path("<run_dir>")
manifest = json.loads((run_dir / "imagegen-jobs.json").read_text())
for job in manifest["jobs"]:
    src = job.get("source_path")
    if isinstance(src, str) and not Path(src).is_absolute():
        src = run_dir / src
    if job.get("status") == "complete":
        assert Path(src).is_file(), f"source missing for {job.get('id')}: {src}"

Prevention

When it happens

Trigger: The recorded source file was deleted, moved, or CODEX_HOME changed so the absolute path now resolves to nothing.

Common situations: Garbage-collection of old generated images before finalize runs; switching machines or HOME; a temp/cleanup process removing generated_images entries.

Related errors


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