{"record":{"id":"183d8d3b521f5d20","repo":"Comfy-Org/ComfyUI","slug":"the-maximum-number-of-reference-images-is-10","errorCode":null,"errorMessage":"The maximum number of reference images is 10.","messagePattern":"The maximum number of reference images is 10\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_api_nodes/nodes_kling.py","lineNumber":1441,"sourceCode":"    async def execute(\n        cls,\n        model_name: str,\n        prompt: str,\n        resolution: str,\n        aspect_ratio: str,\n        series_amount: str = \"disabled\",\n        reference_images: Input.Image | None = None,\n        seed: int = 0,\n    ) -> IO.NodeOutput:\n        _ = seed\n        if model_name == \"kling-image-o1\" and resolution == \"4K\":\n            raise ValueError(\"4K resolution is not supported for kling-image-o1 model.\")\n        prompt = normalize_omni_prompt_references(prompt)\n        validate_string(prompt, min_length=1, max_length=2500)\n        image_list: list[OmniImageParamImage] = []\n        if reference_images is not None:\n            if get_number_of_images(reference_images) > 10:\n                raise ValueError(\"The maximum number of reference images is 10.\")\n            for i in reference_images:\n                validate_image_dimensions(i, min_width=300, min_height=300)\n                validate_image_aspect_ratio(i, (1, 2.5), (2.5, 1))\n            for i in await upload_images_to_comfyapi(cls, reference_images, wait_label=\"Uploading reference image\"):\n                image_list.append(OmniImageParamImage(image=i))\n        use_series = series_amount != \"disabled\"\n        if use_series and model_name == \"kling-image-o1\":\n            raise ValueError(\"kling-image-o1 does not support series generation.\")\n        response = await sync_op(\n            cls,\n            ApiEndpoint(path=\"/proxy/kling/v1/images/omni-image\", method=\"POST\"),\n            response_model=TaskStatusResponse,\n            data=OmniProImageRequest(\n                model_name=model_name,\n                prompt=prompt,\n                resolution=resolution.lower(),\n                aspect_ratio=aspect_ratio,\n                image_list=image_list if image_list else None,","sourceCodeStart":1423,"sourceCodeEnd":1459,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_api_nodes/nodes_kling.py#L1423-L1459","documentation":"Raised by OmniProImageNode.execute when reference_images contains more than 10 images. The omni image endpoint allows up to 10 image references per request; the count is checked with get_number_of_images before upload.","triggerScenarios":"Connecting an 11+ image batch to reference_images on the omni image generation node.","commonSituations":"Whole-folder loaders with unsorted contents, or batched product-photo sets, silently exceed the cap.","solutions":["Trim the batch to at most 10 references","Pre-filter the folder (remove dupes/thumbnails) and pin an explicit file list","Reduce reliance on references by describing key attributes in the prompt"],"exampleFix":"# before\nreference_images = product_shots.images  # 14 images\n\n# after\nreference_images = product_shots.images[:10]  # <= 10","handlingStrategy":"validation","validationCode":"def reference_count_ok_omni_image(reference_images) -> bool:\n    return reference_images is None or get_number_of_images(reference_images) <= 10","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pin explicit file lists instead of wildcard folders for references","Slice batches to 10 at the loader, not at the node"],"tags":["kling","image","reference-images","limit","validation","api-nodes"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}