{"record":{"id":"c1ea87aa5dff062a","repo":"Comfy-Org/ComfyUI","slug":"the-prompt-references-image-idx-but-only-total-c1ea87","errorCode":null,"errorMessage":"The prompt references @Image{idx}, but only {total_images} reference images are connected (a batched input counts once per image).","messagePattern":"The prompt references @Image(.+?), but only (.+?) reference images are connected \\(a batched input counts once per image\\)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_api_nodes/nodes_qwen.py","lineNumber":49,"sourceCode":"    prev_end = -1\n    for match in _IMAGE_REF_RE.finditer(prompt):\n        start = match.start()\n        if start > 0 and start != prev_end and (prompt[start - 1].isalnum() or prompt[start - 1] == \"_\"):\n            continue\n        idx = int(match.group(\"idx\") or 1)\n        if not 1 <= idx <= total_images:\n            raise ValueError(\n                f\"The prompt references @Image{idx}, but only {total_images} reference images \"\n                f\"are connected (a batched input counts once per image).\"\n            )","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_api_nodes/nodes_qwen.py#L31-L67","documentation":"Error \"The prompt references @Image{idx}, but only {total_images} reference images are connected (a batched input counts once per image).\" thrown in Comfy-Org/ComfyUI.","triggerScenarios":"Thrown at comfy_api_nodes/nodes_qwen.py:49 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Connect enough reference images or remove the @ImageN tag from the prompt."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}