Comfy-Org/ComfyUI · error · ValueError
The current maximum number of supported images is {OMNI_MAX_
Error message
The current maximum number of supported images is {OMNI_MAX_IMAGES}. What it means
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.
Source
Thrown at comfy_api_nodes/nodes_gemini.py:1656
IO.Hidden.api_key_comfy_org,
IO.Hidden.unique_id,
],
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(View on GitHub (pinned to 1c6d8d45b3)
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.
Example fix
# before
images = [batch_of_20_frames]
await omni_execute(model={'images': {'i1': images}, ...}, seed=s) # raises
# after
images = [batch_of_20_frames[:14]]
await omni_execute(model={'images': {'i1': images}, ...}, seed=s) Defensive patterns
Strategy: validation
Validate before calling
OMNI_MAX_IMAGES = 14
total = sum(get_number_of_images(t) for t in (model.get("images") or {}).values() if t is not None)
if total > OMNI_MAX_IMAGES:
trim_images(model, limit=OMNI_MAX_IMAGES) Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- The current maximum number of supported videos is {OMNI_MAX_
- The current maximum number of supported images is 14.
- Gemini did not generate a video. Model response: {model_mess
- Gemini did not generate a video. Try rephrasing your prompt,
- Too much media to send inline (over {max_inline_bytes // (10
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/830cce1cffbcd8c0.
Report an issue: GitHub.