{"record":{"id":"58eddb937f7aaf5a","repo":"Comfy-Org/ComfyUI","slug":"the-current-maximum-number-of-supported-images-is","errorCode":null,"errorMessage":"The current maximum number of supported images is 9.","messagePattern":"The current maximum number of supported images is 9\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_api_nodes/nodes_bfl.py","lineNumber":787,"sourceCode":"                expr=cls.PRICE_BADGE_EXPR,\n            ),\n            is_deprecated=True,\n        )\n\n    @classmethod\n    async def execute(\n        cls,\n        prompt: str,\n        width: int,\n        height: int,\n        seed: int,\n        prompt_upsampling: bool,\n        images: Input.Image | None = None,\n    ) -> IO.NodeOutput:\n        reference_images = {}\n        if images is not None:\n            if get_number_of_images(images) > 9:\n                raise ValueError(\"The current maximum number of supported images is 9.\")\n            for image_index in range(images.shape[0]):\n                key_name = f\"input_image_{image_index + 1}\" if image_index else \"input_image\"\n                reference_images[key_name] = tensor_to_base64_string(images[image_index], total_pixels=2048 * 2048)\n        initial_response = await sync_op(\n            cls,\n            ApiEndpoint(path=cls.API_ENDPOINT, method=\"POST\"),\n            response_model=BFLFluxProGenerateResponse,\n            data=Flux2ProGenerateRequest(\n                prompt=prompt,\n                width=width,\n                height=height,\n                seed=seed,\n                prompt_upsampling=prompt_upsampling,\n                **reference_images,\n            ),\n        )\n\n        def price_extractor(_r: BaseModel) -> float | None:","sourceCodeStart":769,"sourceCodeEnd":805,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_api_nodes/nodes_bfl.py#L769-L805","documentation":"The FLUX 2.5 Pro image node hard-codes an upstream BFL limit of 9 reference images per request. The check uses get_number_of_images, which counts frames inside batched image tensors, not the number of connected inputs.","triggerScenarios":"Calling the FLUX 2.5 Pro node with an images tensor whose batch dimension exceeds 9.","commonSituations":"Connecting a batch of reference frames or an image grid where each frame counts toward the limit; upstream nodes that output image batches by default.","solutions":["Slice the batch to at most 9 images: images[:9].","Split the work into multiple requests with <=9 images each.","Select only the needed reference frames instead of wiring the whole batch."],"exampleFix":"# before\nimages = extract_frames(video)      # e.g. 24 frames -> ValueError\n\n# after\nimages = extract_frames(video)[:9]","handlingStrategy":"validation","validationCode":"if images is not None:\n    assert get_number_of_images(images) <= 9, \"FLUX 2.5 Pro accepts max 9 reference images\"","typeGuard":"def flux25_refs_ok(images) -> bool:\n    return images is None or get_number_of_images(images) <= 9","tryCatchPattern":null,"preventionTips":["Slice batches: images[:9].","Count frames, not inputs.","Chunk larger sets across multiple node calls."],"tags":["bfl","flux","reference-images","input-validation","batch"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}