nexu-io/open-design · error · SystemExit

source image is inside the pet run directory; record the ori

Error message

source image is inside the pet run directory; record the original $imagegen output from $CODEX_HOME/generated_images/.../ig_*.png instead

What it means

Raised by validate_source_path() in record_imagegen_result.py when the --source image resolves inside the pet run_dir. The skill forbids re-ingesting copied/derived row strips and requires the original $imagegen output to be recorded instead, so provenance (sha256, source_path) stays truthful. This branch fires before the generated-images check.

Source

Thrown at skills/hatch-pet/scripts/record_imagegen_result.py:93

        return False
    return True


def default_generated_images_root() -> Path:
    codex_home = Path(os.environ.get("CODEX_HOME") or "~/.codex").expanduser().resolve()
    return codex_home / "generated_images"


def validate_source_path(
    *,
    source: Path,
    run_dir: Path,
    allow_synthetic_test_source: bool,
) -> str:
    if allow_synthetic_test_source:
        return "synthetic-test"
    if is_relative_to(source, run_dir):
        raise SystemExit(
            "source image is inside the pet run directory; record the original "
            "$imagegen output from $CODEX_HOME/generated_images/.../ig_*.png instead"
        )
    generated_root = default_generated_images_root()
    if not is_relative_to(source, generated_root) or not source.name.startswith("ig_"):
        raise SystemExit(
            "source image does not look like a built-in $imagegen output; expected "
            f"{generated_root}/.../ig_*.png. Do not ingest locally drawn or "
            "post-processed row strips as visual job outputs."
        )
    return "built-in-imagegen"


def validate_required_grounding(job: dict[str, object], run_dir: Path) -> None:
    if job.get("allow_prompt_only_generation") is not False:
        return
    inputs = job.get("input_images")
    if not isinstance(inputs, list) or not inputs:

View on GitHub (pinned to 5be4028344)

Solutions

  1. Point --source at the original file under $CODEX_HOME/generated_images/.../ig_*.png.
  2. If you genuinely want to record a synthetic fixture, use the hidden --allow-synthetic-test-source flag (test-only).
  3. Remove any copies you made into run_dir and re-resolve the original imagegen path.
  4. Check $CODEX_HOME (default ~/.codex) to locate the generated_images tree.

Example fix

# before
--source /tmp/fenrir/decoded/idle.png   # inside run_dir
# after
--source "$CODEX_HOME/generated_images/2026-01-01/ig_001.png"
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path
run_dir = run_dir.resolve()
source = source.resolve()
if Path(*source.parts[:len(run_dir.parts)]) == run_dir:
    raise SystemExit("source is inside run_dir; pass the original $imagegen ig_*.png")

Prevention

When it happens

Trigger: Pointing --source at run_dir/references/... or run_dir/decoded/...; re-recording an already-copied output; passing an output path that was previously written by this same script.

Common situations: User 'tidies up' by copying the chosen imagegen output into the run_dir first, then records the copy; confusion about which file is canonical.

Related errors


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