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
- Point --source at the original file under $CODEX_HOME/generated_images/.../ig_*.png.
- If you genuinely want to record a synthetic fixture, use the hidden --allow-synthetic-test-source flag (test-only).
- Remove any copies you made into run_dir and re-resolve the original imagegen path.
- 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
- Always record from $CODEX_HOME/generated_images, never from copies inside run_dir.
- Document the canonical source path in your run notes so re-records use the same file.
- If you must record a fixture, gate it behind --allow-synthetic-test-source in tests only.
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
- source image does not look like a built-in $imagegen output;
- {run_dir} already exists and is not empty; pass --force to r
- reference not found: {source}
- file not found: {path}
- row prompt not found: {prompt_path}
AI-assisted analysis of nexu-io/open-design@5be4028344 (2026-08-12).
Data as JSON: /api/errors/b8b3024c9b78f052.
Report an issue: GitHub.