calesthio/OpenMontage · error · ValueError

image_list items must include image, image_url, or image_pat

Error message

image_list items must include image, image_url, or image_path

What it means

ValueError from the omni image-list normalizer when an image_list item is an object but none of its image, image_url, or image_path keys resolve to a usable value via normalize_image_input. Keys with empty strings, None values, or unrecognized key names produce no normalized image and raise.

Source

Thrown at tools/graphics/kling_official_image.py:354

            if not value:
                return
            image_list.append({"image": value, "source": source or value, "source_type": source_type})
            references_used.append(
                {
                    "kind": "image",
                    "source": source or value,
                    "source_type": source_type,
                    "placeholder": f"<<<image_{len(image_list)}>>>",
                }
            )

        for item in inputs.get("image_list") or []:
            if not isinstance(item, dict):
                raise ValueError("image_list items must be objects")
            source = item.get("image") or item.get("image_url") or item.get("image_path")
            value = normalize_image_input(item.get("image") or item.get("image_url"), item.get("image_path"))
            if not value:
                raise ValueError("image_list items must include image, image_url, or image_path")
            add_image(value, source=source, source_type="image_list")
        for url in inputs.get("image_urls") or []:
            add_image(normalize_image_input(url=url), source=url, source_type="image_urls")
        for path in inputs.get("image_paths") or []:
            add_image(normalize_image_input(path=path), source=str(path), source_type="image_paths")
        if inputs.get("image_url") or inputs.get("image_path"):
            add_image(
                normalize_image_input(inputs.get("image_url"), inputs.get("image_path")),
                source=inputs.get("image_url") or inputs.get("image_path"),
                source_type="image",
            )

        return image_list, references_used

    def _download_images(self, client: KlingClient, outputs: list[dict[str, Any]], inputs: dict[str, Any]) -> list[Path]:
        if not outputs:
            raise ValueError("Kling image response contained no images")
        base_path = Path(inputs.get("output_path", "kling_official_image.png"))

View on GitHub (pinned to 95e1c3d0ab)

Solutions

  1. Use exactly one of the keys image, image_url, or image_path per item with a non-empty value
  2. Omit keys you do not have rather than sending null or ''
  3. For local files confirm the path exists — normalize_image_input returns nothing for missing files
  4. Add a pre-flight filter in caller code dropping items that fail validation

Example fix

// before
inputs = {"image_list": [{"url": "https://cdn/img1.png"}]}
// after
inputs = {"image_list": [{"image_url": "https://cdn/img1.png"}]}
Defensive patterns

Strategy: type-guard

Validate before calling

for item in inputs.get("image_list") or []:
    assert item.get("image") or item.get("image_url") or item.get("image_path"), f"item lacks an image key: {item}"

Type guard

def item_has_image(item: dict) -> bool:
    return bool(
        isinstance(item, dict)
        and (item.get("image") or item.get("image_url") or item.get("image_path"))
    )

Prevention

When it happens

Trigger: Passing {"url": "..."} (wrong key name), {"image_url": ""} (empty), or {"image_path": null}; items where all candidate keys are absent; whitespace-only values.

Common situations: Key-name drift between caller and tool (url vs image_url); optional fields serialized as empty strings instead of being omitted; template payloads with placeholder values never filled in.

Related errors


AI-assisted analysis of calesthio/OpenMontage@95e1c3d0ab (2026-08-15). Data as JSON: /api/errors/7bfe34fbfa7065b0. Report an issue: GitHub.