calesthio/OpenMontage · error · ValueError

image_list items must be objects

Error message

image_list items must be objects

What it means

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.

Source

Thrown at tools/graphics/kling_official_image.py:350

        image_list: list[dict[str, Any]] = []
        references_used: list[dict[str, Any]] = []

        def add_image(value: str | None, *, source: str | None, source_type: str) -> None:
            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

View on GitHub (pinned to 95e1c3d0ab)

Solutions

  1. Wrap each entry as an object: use image/image_url or image_path keys
  2. If you only have bare URLs, use the image_urls input instead of image_list
  3. Validate the list shape in your caller before invoking the tool
  4. Add a JSON schema check in agent pipelines that produce image_list

Example fix

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

Strategy: type-guard

Validate before calling

assert all(isinstance(item, dict) for item in inputs.get("image_list") or [])

Type guard

def is_valid_image_list(items: list) -> bool:
    return all(
        isinstance(item, dict)
        and bool(item.get("image") or item.get("image_url") or item.get("image_path"))
        for item in (items or [])
    )

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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