{"record":{"id":"ae90b719b69fea87","repo":"nexu-io/open-design","slug":"source-image-not-found-source","errorCode":null,"errorMessage":"source image not found: {source}","messagePattern":"source image not found: (.+?)","errorType":"exception","errorClass":"SystemExit","httpStatus":null,"severity":"error","filePath":"skills/hatch-pet/scripts/record_imagegen_result.py","lineNumber":174,"sourceCode":"        request[\"canonical_identity_reference\"] = reference\n        request_path.write_text(json.dumps(request, indent=2) + \"\\n\", encoding=\"utf-8\")\n\n\ndef main() -> None:\n    parser = argparse.ArgumentParser(description=__doc__)\n    parser.add_argument(\"--run-dir\", required=True)\n    parser.add_argument(\"--job-id\", required=True)\n    parser.add_argument(\"--source\", required=True)\n    parser.add_argument(\"--force\", action=\"store_true\")\n    parser.add_argument(\n        \"--allow-synthetic-test-source\", action=\"store_true\", help=argparse.SUPPRESS\n    )\n    args = parser.parse_args()\n\n    run_dir = Path(args.run_dir).expanduser().resolve()\n    source = Path(args.source).expanduser().resolve()\n    if not source.is_file():\n        raise SystemExit(f\"source image not found: {source}\")\n    source_provenance = validate_source_path(\n        source=source,\n        run_dir=run_dir,\n        allow_synthetic_test_source=args.allow_synthetic_test_source,\n    )\n\n    manifest_path = run_dir / \"imagegen-jobs.json\"\n    manifest = load_jobs(manifest_path)\n    job = find_job(manifest, args.job_id)\n\n    missing_deps = [\n        dep\n        for dep in job.get(\"depends_on\", [])\n        if isinstance(dep, str) and dep not in completed_job_ids(manifest)\n    ]\n    if missing_deps:\n        raise SystemExit(\n            f\"job {args.job_id} is not ready; missing dependency result(s): {', '.join(missing_deps)}\"","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/nexu-io/open-design/blob/5be4028344c2eb4c667c5a97bda8f750c5597ef7/skills/hatch-pet/scripts/record_imagegen_result.py#L156-L192","documentation":"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.","triggerScenarios":"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.","commonSituations":"Recording a job before $imagegen finished; copy-pasting a path with a placeholder; unexpanded ~ because the arg was quoted oddly.","solutions":["Confirm the file exists: ls -la <source>.","Wait for / re-run the imagegen step that produces the ig_*.png.","Ensure shell variables in the path are expanded (use $CODEX_HOME, not literal '$CODEX_HOME', and that it is set).","Pass the file, not its parent directory."],"exampleFix":"# before\n--source \"$CODEX_HOME/generated_images/ig_.png\"   # typo / not generated\n# after\n--source \"$CODEX_HOME/generated_images/2026-01-01/ig_001.png\"","handlingStrategy":"validation","validationCode":"from pathlib import Path\nsource = Path(args.source).expanduser().resolve()\nif not source.is_file():\n    raise SystemExit(f\"--source not a file: {source}\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Confirm $imagegen finished before invoking the recorder.","Use test -f in your orchestrator before calling record_imagegen_result.py.","Quote paths so shell variables expand correctly."],"tags":["filesystem","cli","hatch-pet","validation"],"backgroundTag":null,"analyzedSha":"5be4028344c2eb4c667c5a97bda8f750c5597ef7","analyzedAt":"2026-08-12T12:03:58.812Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}