{"record":{"id":"6f35aa2cab630769","repo":"Comfy-Org/ComfyUI","slug":"the-maximum-number-of-reference-images-is-7","errorCode":null,"errorMessage":"The maximum number of reference images is 7.","messagePattern":"The maximum number of reference images is 7\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_api_nodes/nodes_kling.py","lineNumber":1103,"sourceCode":"                sb_prompt = storyboards[f\"storyboard_{i}_prompt\"]\n                sb_duration = storyboards[f\"storyboard_{i}_duration\"]\n                validate_string(sb_prompt, field_name=f\"storyboard_{i}_prompt\", min_length=1, max_length=512)\n                multi_prompt_list.append(\n                    MultiPromptEntry(\n                        index=i,\n                        prompt=sb_prompt,\n                        duration=str(sb_duration),\n                    )\n                )\n            total_storyboard_duration = sum(int(e.duration) for e in multi_prompt_list)\n            if total_storyboard_duration != duration:\n                raise ValueError(\n                    f\"Total storyboard duration ({total_storyboard_duration}s) \"\n                    f\"must equal the global duration ({duration}s).\"\n                )\n\n        if get_number_of_images(reference_images) > 7:\n            raise ValueError(\"The maximum number of reference images is 7.\")\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        image_list: list[OmniParamImage] = []\n        for i in await upload_images_to_comfyapi(cls, reference_images, wait_label=\"Uploading reference image\"):\n            image_list.append(OmniParamImage(image_url=i))\n        if resolution == \"4k\":\n            mode = \"4k\"\n        elif resolution == \"1080p\":\n            mode = \"pro\"\n        else:\n            mode = \"std\"\n        response = await sync_op(\n            cls,\n            ApiEndpoint(path=\"/proxy/kling/v1/videos/omni-video\", method=\"POST\"),\n            response_model=TaskStatusResponse,\n            data=OmniProReferences2VideoRequest(\n                model_name=model_name,","sourceCodeStart":1085,"sourceCodeEnd":1121,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_api_nodes/nodes_kling.py#L1085-L1121","documentation":"Raised by OmniProImageToVideoNode.execute when the reference_images batch exceeds 7 images. This node (first-frame driven image-to-video) allows up to 7 omni reference images; the count check happens before upload via get_number_of_images.","triggerScenarios":"Connecting a batch of 8+ images to reference_images on the OmniPro image-to-video node.","commonSituations":"A folder loader or batch-concat node emits more frames than expected (hidden extra files, growing folder), pushing the count past 7.","solutions":["Slice the reference batch to at most 7 images","Curate the reference set down to the most informative frames","Check for stray/duplicate frames in the source folder feeding the batch"],"exampleFix":"# before\nreference_images = folder_batch.images  # 12 images\n\n# after\nreference_images = folder_batch.images[:7]  # <= 7","handlingStrategy":"validation","validationCode":"def reference_count_ok_image2video(reference_images) -> bool:\n    return reference_images is None or get_number_of_images(reference_images) <= 7","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Slice reference batches to 7 for the image-to-video omni node","Note the per-node cap differences: 7 here, 6 on first/last-frame, 4 with video input"],"tags":["kling","video","reference-images","limit","validation","api-nodes"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}