{"record":{"id":"865b3a90e936ef12","repo":"Comfy-Org/ComfyUI","slug":"too-many-reference-images-total-images-images","errorCode":null,"errorMessage":"Too many reference images: {total_images} (images={len(reference_images)}, image assets={len(reference_image_assets)}). Maximum is {limits['max_images']}.","messagePattern":"Too many reference images: (.+?) \\(images=(.+?), image assets=(.+?)\\)\\. Maximum is (.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_api_nodes/nodes_bytedance.py","lineNumber":2752,"sourceCode":"        reference_images = model.get(\"reference_images\", {})\n        reference_videos = model.get(\"reference_videos\", {})\n        reference_audios = model.get(\"reference_audios\", {})\n        reference_assets = model.get(\"reference_assets\", {})\n\n        reference_image_assets, reference_video_assets, reference_audio_assets = await _resolve_reference_assets(\n            cls, list(reference_assets.values())\n        )\n\n        model_id = SEEDANCE_MODELS[model[\"model\"]]\n        limits = seedance2_reference_limits(model_id)\n\n        if not reference_images and not reference_videos and not reference_image_assets and not reference_video_assets:\n            if model_id != \"dreamina-seedance-2-5-260628\" or not (reference_audios or reference_audio_assets):\n                raise ValueError(\"At least one reference image or video or asset is required.\")\n\n        total_images = len(reference_images) + len(reference_image_assets)\n        if total_images > limits[\"max_images\"]:\n            raise ValueError(\n                f\"Too many reference images: {total_images} \"\n                f\"(images={len(reference_images)}, image assets={len(reference_image_assets)}). \"\n                f\"Maximum is {limits['max_images']}.\"\n            )\n        total_videos = len(reference_videos) + len(reference_video_assets)\n        if total_videos > limits[\"max_videos\"]:\n            raise ValueError(\n                f\"Too many reference videos: {total_videos} \"\n                f\"(videos={len(reference_videos)}, video assets={len(reference_video_assets)}). \"\n                f\"Maximum is {limits['max_videos']}.\"\n            )\n        total_audios = len(reference_audios) + len(reference_audio_assets)\n        if total_audios > limits[\"max_audios\"]:\n            raise ValueError(\n                f\"Too many reference audios: {total_audios} \"\n                f\"(audios={len(reference_audios)}, audio assets={len(reference_audio_assets)}). \"\n                f\"Maximum is {limits['max_audios']}.\"\n            )","sourceCodeStart":2734,"sourceCodeEnd":2770,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_api_nodes/nodes_bytedance.py#L2734-L2770","documentation":"Per-model reference limits (seedance2_reference_limits, e.g. 30 images for Seedance 2.5, fewer for other models) are enforced client-side. The count combines direct image inputs plus resolved image assets; exceeding max_images raises with a breakdown of both counts and the cap so the user knows exactly how much to trim.","triggerScenarios":"Wiring more reference_images than the cap, or a combination of reference_images and reference_assets entries (each asset dict value counts) whose total exceeds limits[\"max_images\"] for the selected model.","commonSituations":"Using Autogrow reference inputs with large image batches; mixing uploaded assets and direct images; switching to a model with a lower limit than the workflow was built for.","solutions":["Reduce the total number of image references (direct + assets) to at most the stated maximum.","Prefer fewer, stronger reference images since quality does not scale with count.","Check seedance2_reference_limits for the selected model before wiring."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"from comfy_api_nodes.apis.bytedance import seedance2_reference_limits\ntotal = len(reference_images) + len(reference_image_assets)\nassert total <= seedance2_reference_limits(model_id)[\"max_images\"]","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Look up seedance2_reference_limits for the selected model before wiring references.","Count direct images and asset ids together; both consume the same quota."],"tags":["bytedance","seedance","validation","limits","api-nodes"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}