nexu-io/open-design · error · SystemExit

source image not found: {source}

Error message

source image not found: {source}

What it means

Raised in record_imagegen_result.py main() when Path(args.source) does not resolve to a regular file. It is the earliest guard, fired before validate_source_path and before the manifest is loaded, so the user gets a fast failure for a bad --source.

Source

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

        request["canonical_identity_reference"] = reference
        request_path.write_text(json.dumps(request, indent=2) + "\n", encoding="utf-8")


def main() -> None:
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument("--run-dir", required=True)
    parser.add_argument("--job-id", required=True)
    parser.add_argument("--source", required=True)
    parser.add_argument("--force", action="store_true")
    parser.add_argument(
        "--allow-synthetic-test-source", action="store_true", help=argparse.SUPPRESS
    )
    args = parser.parse_args()

    run_dir = Path(args.run_dir).expanduser().resolve()
    source = Path(args.source).expanduser().resolve()
    if not source.is_file():
        raise SystemExit(f"source image not found: {source}")
    source_provenance = validate_source_path(
        source=source,
        run_dir=run_dir,
        allow_synthetic_test_source=args.allow_synthetic_test_source,
    )

    manifest_path = run_dir / "imagegen-jobs.json"
    manifest = load_jobs(manifest_path)
    job = find_job(manifest, args.job_id)

    missing_deps = [
        dep
        for dep in job.get("depends_on", [])
        if isinstance(dep, str) and dep not in completed_job_ids(manifest)
    ]
    if missing_deps:
        raise SystemExit(
            f"job {args.job_id} is not ready; missing dependency result(s): {', '.join(missing_deps)}"

View on GitHub (pinned to 5be4028344)

Solutions

  1. Confirm the file exists: ls -la <source>.
  2. Wait for / re-run the imagegen step that produces the ig_*.png.
  3. Ensure shell variables in the path are expanded (use $CODEX_HOME, not literal '$CODEX_HOME', and that it is set).
  4. Pass the file, not its parent directory.

Example fix

# before
--source "$CODEX_HOME/generated_images/ig_.png"   # typo / not generated
# after
--source "$CODEX_HOME/generated_images/2026-01-01/ig_001.png"
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path
source = Path(args.source).expanduser().resolve()
if not source.is_file():
    raise SystemExit(f"--source not a file: {source}")

Prevention

When it happens

Trigger: Typo in --source; the imagegen run did not actually write the file yet; --source points at a directory; shell variable ($CODEX_HOME) was empty so the path collapsed.

Common situations: Recording a job before $imagegen finished; copy-pasting a path with a placeholder; unexpanded ~ because the arg was quoted oddly.

Related errors


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