nexu-io/open-design · error · SystemExit

source image does not look like a built-in $imagegen output;

Error message

source image does not look like a built-in $imagegen output; expected {generated_root}/.../ig_*.png. Do not ingest locally drawn or post-processed row strips as visual job outputs.

What it means

Raised by validate_source_path() in record_imagegen_result.py when the --source is not inside $CODEX_HOME/generated_images or its filename does not start with 'ig_'. The recorder only accepts built-in $imagegen outputs (or explicit synthetic test sources) so locally drawn or post-processed strips cannot be ingested as job results.

Source

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

    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:
        raise SystemExit(
            f"job {job.get('id')} does not list input_images; grounded row jobs must attach references"
        )
    missing = []
    for item in inputs:
        if not isinstance(item, dict) or not isinstance(item.get("path"), str):

View on GitHub (pinned to 5be4028344)

Solutions

  1. Locate the original ig_*.png under your generated_images root and pass that path.
  2. Ensure $CODEX_HOME matches the environment $imagegen actually wrote to.
  3. Do not rename the imagegen output before recording; keep the ig_ prefix.
  4. For test fixtures only, use --allow-synthetic-test-source.

Example fix

# before
--source ~/Desktop/touched-up.png
# after
CODEX_HOME=~/.codex record_imagegen_result.py --source ~/.codex/generated_images/.../ig_001.png
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path, os
gen_root = Path(os.environ.get("CODEX_HOME") or "~/.codex").expanduser().resolve()
try:
    source.resolve().relative_to(gen_root)
except ValueError:
    raise SystemExit(f"source not under {gen_root}/generated_images/ig_*.png")
if not source.name.startswith("ig_"):
    raise SystemExit("source filename must start with ig_")

Prevention

When it happens

Trigger: Passing a hand-drawn PNG from ~/Desktop; a re-saved/exported copy that lost the ig_ prefix; $CODEX_HOME is unset so default_generated_images_root() resolves to ~/.codex/generated_images while the real outputs live elsewhere.

Common situations: User edited the imagegen output in Photoshop and tries to record the edit; CODEX_HOME overridden in a container so the path check fails; file was renamed after generation.

Related errors


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