nexu-io/open-design · error · SystemExit
job {job_id} source image is inside the pet run directory; d
Error message
job {job_id} source image is inside the pet run directory; do not use locally generated row artifacts as visual sources What it means
Raised by validate_completed_job_source when a built-in-imagegen job's source_path resolves inside the pet run directory itself. Locally generated row artifacts under run_dir must not be used as visual sources; finalize enforces that the source lives outside the run (specifically under the Codex generated_images root).
Source
Thrown at skills/hatch-pet/scripts/finalize_pet_run.py:168
return
if job.get("secondary_fallback"):
if job.get("source_provenance") != "secondary-fallback-image-api":
raise SystemExit(f"job {job_id} has invalid secondary fallback provenance")
validate_hash(job, source=source, output=output, job_id=job_id)
return
if job.get("source_provenance") == "deterministic-mirror":
validate_mirror_hash(job, source=source, output=output, job_id=job_id)
return
if job.get("source_provenance") != "built-in-imagegen":
raise SystemExit(
f"job {job_id} was not recorded as a built-in $imagegen output; "
"use record_imagegen_result.py with the selected $CODEX_HOME/generated_images/.../ig_*.png file"
)
if is_relative_to(source, run_dir):
raise SystemExit(
f"job {job_id} source image is inside the pet run directory; "
"do not use locally generated row artifacts as visual sources"
)
generated_root = default_generated_images_root()
if not is_relative_to(source, generated_root) or not source.name.startswith("ig_"):
raise SystemExit(
f"job {job_id} source image is not a built-in $imagegen output under "
f"{generated_root}/.../ig_*.png"
)
validate_hash(job, source=source, output=output, job_id=job_id)
def require_complete_jobs(run_dir: Path, *, allow_synthetic_test_sources: bool) -> None:
manifest_path = run_dir / "imagegen-jobs.json"
manifest = load_json(manifest_path)
jobs = manifest.get("jobs")
if not isinstance(jobs, list):
raise SystemExit("invalid imagegen-jobs.json: jobs must be a list")View on GitHub (pinned to 5be4028344)
Solutions
- Record the original $CODEX_HOME/generated_images/.../ig_*.png path as source_path via record_imagegen_result.py.
- Remove any copied source files from run_dir so the path cannot resolve inside it.
- Re-run finalize_pet_run.py once source_path points outside run_dir.
Example fix
// before (imagegen-jobs.json) "source_path": "raw/base.png" // after "source_path": "~/.codex/generated_images/2026-01-01/ig_abc123.png"
Defensive patterns
Strategy: validation
Validate before calling
def is_relative_to(p, root):
try: p.relative_to(root); return True
except ValueError: return False
if is_relative_to(source, run_dir):
raise RuntimeError(f'source_path must point outside run_dir: {source}') Prevention
- Always record the original $CODEX_HOME/generated_images/.../ig_*.png path as source_path.
- Never copy generated sources into run_dir before recording.
- Lint source_path to ensure it escapes the run directory.
When it happens
Trigger: is_relative_to(source, run_dir) is true for a job whose source_provenance == 'built-in-imagegen'. Caused by pointing source_path at run_dir/raw/... or run_dir/decoded/... instead of the real ig_*.png.
Common situations: Copying a generated image into the run directory and recording that path; using an intermediate decoded artifact as the recorded source.
Related errors
- job {job_id} source image is not a built-in $imagegen output
- running-left mirror source must be decoded/running-right.png
- running-left mirror output must be decoded/running-left.png
- job {job_id} was marked as a local/synthetic row ({', '.join
- job {job_id} uses a synthetic test source; rerun with real $
AI-assisted analysis of nexu-io/open-design@5be4028344 (2026-08-12).
Data as JSON: /api/errors/736cafb4392cfd21.
Report an issue: GitHub.