{"record":{"id":"2a1969c8ba4b9609","repo":"calesthio/OpenMontage","slug":"image-list-items-must-be-objects","errorCode":null,"errorMessage":"image_list items must be objects","messagePattern":"image_list items must be objects","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"tools/graphics/kling_official_image.py","lineNumber":350,"sourceCode":"        image_list: list[dict[str, Any]] = []\n        references_used: list[dict[str, Any]] = []\n\n        def add_image(value: str | None, *, source: str | None, source_type: str) -> None:\n            if not value:\n                return\n            image_list.append({\"image\": value, \"source\": source or value, \"source_type\": source_type})\n            references_used.append(\n                {\n                    \"kind\": \"image\",\n                    \"source\": source or value,\n                    \"source_type\": source_type,\n                    \"placeholder\": f\"<<<image_{len(image_list)}>>>\",\n                }\n            )\n\n        for item in inputs.get(\"image_list\") or []:\n            if not isinstance(item, dict):\n                raise ValueError(\"image_list items must be objects\")\n            source = item.get(\"image\") or item.get(\"image_url\") or item.get(\"image_path\")\n            value = normalize_image_input(item.get(\"image\") or item.get(\"image_url\"), item.get(\"image_path\"))\n            if not value:\n                raise ValueError(\"image_list items must include image, image_url, or image_path\")\n            add_image(value, source=source, source_type=\"image_list\")\n        for url in inputs.get(\"image_urls\") or []:\n            add_image(normalize_image_input(url=url), source=url, source_type=\"image_urls\")\n        for path in inputs.get(\"image_paths\") or []:\n            add_image(normalize_image_input(path=path), source=str(path), source_type=\"image_paths\")\n        if inputs.get(\"image_url\") or inputs.get(\"image_path\"):\n            add_image(\n                normalize_image_input(inputs.get(\"image_url\"), inputs.get(\"image_path\")),\n                source=inputs.get(\"image_url\") or inputs.get(\"image_path\"),\n                source_type=\"image\",\n            )\n\n        return image_list, references_used\n","sourceCodeStart":332,"sourceCodeEnd":368,"githubUrl":"https://github.com/calesthio/OpenMontage/blob/95e1c3d0ab93482159818560f6a8c8e866b9139f/tools/graphics/kling_official_image.py#L332-L368","documentation":"ValueError from the omni image-list normalizer when an entry of the image_list input is not a dict/object. Each image_list item must be an object carrying image/image_url/image_path keys; strings or numbers are rejected even if they look like URLs.","triggerScenarios":"Passing image_list: [\"https://...\"] (bare URL strings) instead of [{\"image_url\": \"https://...\"}]; passing YAML/JSON that parsed scalars into the list; agent serialization bugs emitting arrays of strings.","commonSituations":"Confusion with image_urls (which does accept bare strings); JSON schema mismatch between caller and tool; hand-written config files where the object braces were dropped.","solutions":["Wrap each entry as an object: use image/image_url or image_path keys","If you only have bare URLs, use the image_urls input instead of image_list","Validate the list shape in your caller before invoking the tool","Add a JSON schema check in agent pipelines that produce image_list"],"exampleFix":"// before\ninputs = {\"image_list\": [\"https://cdn/img1.png\", \"https://cdn/img2.png\"]}\n// after\ninputs = {\"image_list\": [\n  {\"image_url\": \"https://cdn/img1.png\"},\n  {\"image_url\": \"https://cdn/img2.png\"}\n]}","handlingStrategy":"type-guard","validationCode":"assert all(isinstance(item, dict) for item in inputs.get(\"image_list\") or [])","typeGuard":"def is_valid_image_list(items: list) -> bool:\n    return all(\n        isinstance(item, dict)\n        and bool(item.get(\"image\") or item.get(\"image_url\") or item.get(\"image_path\"))\n        for item in (items or [])\n    )","tryCatchPattern":null,"preventionTips":["Use image_urls for bare URL strings; image_list only for objects","Schema-validate agent-produced payloads","Write a unit test covering both list shapes"],"tags":["kling","image-generation","validation","input-shape"],"backgroundTag":null,"analyzedSha":"95e1c3d0ab93482159818560f6a8c8e866b9139f","analyzedAt":"2026-08-15T06:31:20.014Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}