Comfy-Org/ComfyUI · error · ValueError
No images provided to create_image_parts; at least one image
Error message
No images provided to create_image_parts; at least one image is required.
What it means
Raised by create_image_parts() when the total image count across all supplied tensors is zero — either an empty list was passed or every tensor has get_number_of_images() == 0. It guards against building a content array with no image parts before any upload happens.
Source
Thrown at comfy_api_nodes/nodes_gemini.py:101
)
""",
)
async def create_image_parts(
cls: type[IO.ComfyNode],
images: Input.Image | list[Input.Image],
image_limit: int = 0,
) -> list[GeminiPart]:
image_parts: list[GeminiPart] = []
if image_limit < 0:
raise ValueError("image_limit must be greater than or equal to 0 when creating Gemini image parts.")
# Accept either a single (possibly-batched) tensor or a list of them; share URL budget across all.
images_list: list[Input.Image] = images if isinstance(images, list) else [images]
total_images = sum(get_number_of_images(img) for img in images_list)
if total_images <= 0:
raise ValueError("No images provided to create_image_parts; at least one image is required.")
# If image_limit == 0 --> use all images; otherwise clamp to image_limit.
effective_max = total_images if image_limit == 0 else min(total_images, image_limit)
# Number of images we'll send as URLs (fileData)
num_url_images = min(effective_max, 10) # Vertex API max number of image links
upload_kwargs: dict = {"wait_label": "Uploading reference images"}
if effective_max > num_url_images:
# Split path (e.g. 11+ images): suppress per-image counter to avoid a confusing dual-fraction label.
upload_kwargs = {
"wait_label": f"Uploading reference images ({num_url_images}+)",
"show_batch_index": False,
}
reference_images_urls = await upload_images_to_comfyapi(
cls,
images_list,
max_images=num_url_images,
**upload_kwargs,View on GitHub (pinned to 1c6d8d45b3)
Solutions
- Verify the upstream image source actually outputs at least one image (inspect it with a Preview Image node).
- If a filter/picker can legitimately yield zero images, gate the Gemini call on the count (e.g. ImagePadForOutpaint-style switch or a conditional bypass).
- Fix the empty batch at its source (correct folder, correct mask selection) rather than patching here.
Defensive patterns
Strategy: validation
Validate before calling
def has_any_images(images) -> bool:
imgs = images if isinstance(images, list) else [images]
return sum(img.shape[0] if img.ndim == 4 else 1 for img in imgs) > 0
# skip or bypass the Gemini call when has_any_images(images) is False Prevention
- Preview upstream image outputs before Gemini nodes in branching workflows.
- Guard optional-image paths with a count check so zero-image branches skip the call.
When it happens
Trigger: create_image_parts called with an empty list, or with image tensors whose first dimension is 0 (empty batch); typically when an upstream node produced a zero-length batch.
Common situations: An image-picker/filter upstream legitimately matched zero images; a Load Image batch loaded an empty directory; upstream node error swallowed into an empty tensor; branching workflows where one branch has no images selected.
Related errors
- Up to {SEED_MAX_IMAGES} images are supported per request.
- image_limit must be greater than or equal to 0 when creating
- Cannot create grid from empty image list
- INVALID_TAG_FILTER
- Connect at least one keyframe image.
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/45129dcf32ba9c87.
Report an issue: GitHub.