{"record":{"id":"830cce1cffbcd8c0","repo":"Comfy-Org/ComfyUI","slug":"the-current-maximum-number-of-supported-images-is-830cce","errorCode":null,"errorMessage":"The current maximum number of supported images is {OMNI_MAX_IMAGES}.","messagePattern":"The current maximum number of supported images is (.+?)\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_api_nodes/nodes_gemini.py","lineNumber":1656,"sourceCode":"                IO.Hidden.api_key_comfy_org,\n                IO.Hidden.unique_id,\n            ],\n            is_api_node=True,\n            price_badge=IO.PriceBadge(\n                expr='{\"type\":\"usd\",\"usd\":0.101,\"format\":{\"suffix\":\"/second\",\"approximate\":true}}'\n            ),\n        )\n\n    @classmethod\n    async def execute(cls, model: dict, seed: int) -> IO.NodeOutput:\n        prompt = model.get(\"prompt\") or \"\"\n        validate_string(prompt, strip_whitespace=True, min_length=1)\n        model_id = OMNI_MODELS[model[\"model\"]]\n\n        images = [t for t in (model.get(\"images\") or {}).values() if t is not None]\n        videos = [v for v in (model.get(\"videos\") or {}).values() if v is not None]\n        if sum(get_number_of_images(t) for t in images) > OMNI_MAX_IMAGES:\n            raise ValueError(f\"The current maximum number of supported images is {OMNI_MAX_IMAGES}.\")\n        if len(videos) > OMNI_MAX_VIDEOS:\n            raise ValueError(f\"The current maximum number of supported videos is {OMNI_MAX_VIDEOS}.\")\n        for video in videos:\n            validate_video_duration(video, max_duration=10)\n\n        parts: list[GeminiInteractionTextPart | GeminiInteractionMediaPart] = []\n        if images or videos:\n            # The Interactions API accepts video only inline or as a Files API URI, not as an HTTP URL.\n            media_parts = await build_gemini_media_parts(\n                cls, [], [], videos, url_budget=0, max_inline_bytes=GEMINI_INTERACTIONS_MAX_INLINE_BYTES\n            )\n            video_inline_bytes = sum(len(p.inlineData.data) for p in media_parts)\n            media_parts += await build_gemini_media_parts(\n                cls, images, [], [], max_inline_bytes=GEMINI_INTERACTIONS_MAX_INLINE_BYTES - video_inline_bytes\n            )\n            parts.extend(to_interaction_media_part(p) for p in media_parts)\n        parts.append(GeminiInteractionTextPart(text=prompt))\n        interaction = await sync_op(","sourceCodeStart":1638,"sourceCodeEnd":1674,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_api_nodes/nodes_gemini.py#L1638-L1674","documentation":"The omni (Interactions API) node enforces OMNI_MAX_IMAGES = 14: the summed image count over all connected image tensors may not exceed 14. Videos have their own separate cap. The check runs client-side before media parts are built, so no API quota is consumed when it fires.","triggerScenarios":"Executing the Gemini omni node with model['images'] tensors whose get_number_of_images sum exceeds OMNI_MAX_IMAGES (14). Batched tensors count per image.","commonSituations":"Feeding a long frame extraction plus reference photos into the omni node expecting it to handle video; porting workflows from the image-only nodes without recounting; batch sizes sized for other providers.","solutions":["Trim connected images so the total across all sockets is ≤14.","Move some visual context into the videos input (subject to OMNI_MAX_VIDEOS = 3) instead of many stills.","Split the task into multiple interactions with smaller image sets."],"exampleFix":"# before\nimages = [batch_of_20_frames]\nawait omni_execute(model={'images': {'i1': images}, ...}, seed=s)  # raises\n\n# after\nimages = [batch_of_20_frames[:14]]\nawait omni_execute(model={'images': {'i1': images}, ...}, seed=s)","handlingStrategy":"validation","validationCode":"OMNI_MAX_IMAGES = 14\ntotal = sum(get_number_of_images(t) for t in (model.get(\"images\") or {}).values() if t is not None)\nif total > OMNI_MAX_IMAGES:\n    trim_images(model, limit=OMNI_MAX_IMAGES)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Budget 14 images total across the omni node's image sockets.","Move some visual context into the (up to 3) video inputs instead.","Slice frame batches before wiring them in."],"tags":["gemini","interactions-api","input-validation","limit","omni","comfy-api-nodes"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}