Comfy-Org/ComfyUI · error · ValueError

The current maximum number of supported videos is {OMNI_MAX_

Error message

The current maximum number of supported videos is {OMNI_MAX_VIDEOS}.

What it means

The omni node's video cap: at most OMNI_MAX_VIDEOS = 3 video inputs may be connected. Each connected video socket counts once regardless of length, and each video is separately validated to ≤10 s duration (validate_video_duration). This guard runs before the interaction request is assembled.

Source

Thrown at comfy_api_nodes/nodes_gemini.py:1658

            ],
            is_api_node=True,
            price_badge=IO.PriceBadge(
                expr='{"type":"usd","usd":0.101,"format":{"suffix":"/second","approximate":true}}'
            ),
        )

    @classmethod
    async def execute(cls, model: dict, seed: int) -> IO.NodeOutput:
        prompt = model.get("prompt") or ""
        validate_string(prompt, strip_whitespace=True, min_length=1)
        model_id = OMNI_MODELS[model["model"]]

        images = [t for t in (model.get("images") or {}).values() if t is not None]
        videos = [v for v in (model.get("videos") or {}).values() if v is not None]
        if sum(get_number_of_images(t) for t in images) > OMNI_MAX_IMAGES:
            raise ValueError(f"The current maximum number of supported images is {OMNI_MAX_IMAGES}.")
        if len(videos) > OMNI_MAX_VIDEOS:
            raise ValueError(f"The current maximum number of supported videos is {OMNI_MAX_VIDEOS}.")
        for video in videos:
            validate_video_duration(video, max_duration=10)

        parts: list[GeminiInteractionTextPart | GeminiInteractionMediaPart] = []
        if images or videos:
            # The Interactions API accepts video only inline or as a Files API URI, not as an HTTP URL.
            media_parts = await build_gemini_media_parts(
                cls, [], [], videos, url_budget=0, max_inline_bytes=GEMINI_INTERACTIONS_MAX_INLINE_BYTES
            )
            video_inline_bytes = sum(len(p.inlineData.data) for p in media_parts)
            media_parts += await build_gemini_media_parts(
                cls, images, [], [], max_inline_bytes=GEMINI_INTERACTIONS_MAX_INLINE_BYTES - video_inline_bytes
            )
            parts.extend(to_interaction_media_part(p) for p in media_parts)
        parts.append(GeminiInteractionTextPart(text=prompt))
        interaction = await sync_op(
            cls,
            ApiEndpoint(path=GEMINI_INTERACTIONS_ENDPOINT, method="POST"),

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Disconnect videos until at most 3 remain; pick the most informative clips.
  2. Concatenate excess clips into one video upstream (then confirm each still passes the 10 s duration check).
  3. Move some content to images if the 14-image budget has room.

Example fix

# before
model['videos'] = {'v1': a, 'v2': b, 'v3': c, 'v4': d}  # 4 videos -> raises

# after
model['videos'] = {'v1': a, 'v2': b, 'v3': concat(c, d)}
Defensive patterns

Strategy: validation

Validate before calling

OMNI_MAX_VIDEOS = 3
videos = [v for v in (model.get("videos") or {}).values() if v is not None]
assert len(videos) <= OMNI_MAX_VIDEOS, f"{len(videos)} videos connected; limit is 3"

Prevention

When it happens

Trigger: Executing the Gemini omni node with more than 3 non-None entries in model['videos'] — e.g. four LoadVideo outputs wired into four video sockets.

Common situations: Story-boarding workflows that wire in many short clips; users assuming the video cap matches the image cap (14); combining reference clips plus a style clip plus source footage exceeding three.

Related errors


AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14). Data as JSON: /api/errors/e6dcce28122326cf. Report an issue: GitHub.