Comfy-Org/ComfyUI · error · ValueError
The prompt references @Image{idx}, but only {total_images} r
Error message
The prompt references @Image{idx}, but only {total_images} reference images are connected (a batched input counts once per image). What it means
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.
Source
Thrown at comfy_api_nodes/nodes_qwen.py:49
prev_end = -1
for match in _IMAGE_REF_RE.finditer(prompt):
start = match.start()
if start > 0 and start != prev_end and (prompt[start - 1].isalnum() or prompt[start - 1] == "_"):
continue
idx = int(match.group("idx") or 1)
if not 1 <= idx <= total_images:
raise ValueError(
f"The prompt references @Image{idx}, but only {total_images} reference images "
f"are connected (a batched input counts once per image)."
)View on GitHub (pinned to 1c6d8d45b3)
Solutions
- Connect enough reference images or remove the @ImageN tag from the prompt.
When it happens
Trigger: Thrown at comfy_api_nodes/nodes_qwen.py:49 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/c1ea87aa5dff062a.
Report an issue: GitHub.