{"record":{"id":"7a5fb1dbae0568aa","repo":"nexu-io/open-design","slug":"job-job-get-id-has-invalid-input-image-entry","errorCode":null,"errorMessage":"job {job.get('id')} has invalid input image entry","messagePattern":"job (.+?) has invalid input image entry","errorType":"exception","errorClass":"SystemExit","httpStatus":null,"severity":"error","filePath":"skills/hatch-pet/scripts/generate_pet_images.py","lineNumber":216,"sourceCode":"        \"source_job\": \"base\",\n        \"sha256\": file_sha256(canonical),\n    }\n    manifest[\"canonical_identity_reference\"] = reference\n    request_path = run_dir / \"pet_request.json\"\n    if request_path.exists():\n        request = json.loads(request_path.read_text(encoding=\"utf-8\"))\n        request[\"canonical_identity_reference\"] = reference\n        request_path.write_text(json.dumps(request, indent=2) + \"\\n\", encoding=\"utf-8\")\n\n\ndef path_list(run_dir: Path, job: dict[str, object]) -> list[Path]:\n    inputs = job.get(\"input_images\")\n    if not isinstance(inputs, list):\n        raise SystemExit(f\"job {job.get('id')} has invalid input_images\")\n    paths = []\n    for item in inputs:\n        if not isinstance(item, dict) or not isinstance(item.get(\"path\"), str):\n            raise SystemExit(f\"job {job.get('id')} has invalid input image entry\")\n        path = (run_dir / item[\"path\"]).resolve()\n        if not path.is_relative_to(run_dir):\n            raise SystemExit(f\"path traversal detected in input_images for job {job.get('id')}\")\n        if not path.is_file():\n            raise SystemExit(f\"input image for job {job.get('id')} not found: {path}\")\n        paths.append(path)\n    return paths\n\n\ndef main() -> None:\n    parser = argparse.ArgumentParser(description=__doc__)\n    parser.add_argument(\"--run-dir\", required=True)\n    parser.add_argument(\"--model\", default=\"gpt-image-2\")\n    parser.add_argument(\"--size\", default=\"1024x1024\")\n    parser.add_argument(\"--states\", default=\"all\")\n    parser.add_argument(\"--job-id\", action=\"append\", default=[])\n    parser.add_argument(\"--skip-base\", action=\"store_true\")\n    args = parser.parse_args()","sourceCodeStart":198,"sourceCodeEnd":234,"githubUrl":"https://github.com/nexu-io/open-design/blob/5be4028344c2eb4c667c5a97bda8f750c5597ef7/skills/hatch-pet/scripts/generate_pet_images.py#L198-L234","documentation":"Raised by path_list while iterating a job's input_images list: an element is not a dict, or its path field is not a string. Each input image must be an object with a string path.","triggerScenarios":"An input_images array entry is a bare string path, a number, null, or a dict missing the path key (e.g. {\"role\": \"...\"} with no path).","commonSituations":"Hand-edited manifest using shorthand string paths instead of objects; a tool that writes input_images entries without the path key; mixing schemas from an older manifest version.","solutions":["Inspect the failing job's input_images in imagegen-jobs.json.","Make every entry an object {\"path\": \"<relpath>\", \"role\": \"...\"} with a string path.","Regenerate the manifest with prepare_pet_run.py if many entries are malformed.","Rerun the job."],"exampleFix":"// before (manifest)\n\"input_images\": [\n  \"references/canonical-base.png\",\n  {\"role\": \"layout guide\"}\n]\n\n// after\n\"input_images\": [\n  {\"path\": \"references/canonical-base.png\", \"role\": \"canonical identity reference\"},\n  {\"path\": \"references/layout-guides/idle.png\", \"role\": \"layout guide\"}\n]","handlingStrategy":"type-guard","validationCode":"def valid_input_entry(item: object) -> bool:\n    return isinstance(item, dict) and isinstance(item.get(\"path\"), str)","typeGuard":"def is_input_entry(item: object) -> bool:\n    return isinstance(item, dict) and isinstance(item.get(\"path\"), str)","tryCatchPattern":null,"preventionTips":["Use prepare_pet_run.py to author input_images entries so they always match the expected shape.","Run pet_job_status.py before generation; it tolerates malformed entries (returns exists=False) and surfaces problems early.","Add a CI lint that jsonschema-validates imagegen-jobs.json against the documented shape."],"tags":["manifest","json-schema","validation","system-exit"],"backgroundTag":null,"analyzedSha":"5be4028344c2eb4c667c5a97bda8f750c5597ef7","analyzedAt":"2026-08-12T12:03:58.812Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}