Comfy-Org/ComfyUI · error · ValueError

Aleph2 supports at most 5 prompt images.

Error message

Aleph2 supports at most 5 prompt images.

What it means

Raised by the Aleph2 node when the prompt_images collection contains more than 5 items. Mirror of the keyframe cap: the Runway Aleph2 API limits prompt-image guidance to 5 images, checked before uploading each image.

Source

Thrown at comfy_api_nodes/nodes_runway.py:808

        video_url = await upload_video_to_comfyapi(cls, video)

        keyframe_models: list[RunwayAleph2KeyframeSeconds | RunwayAleph2KeyframeAt] = []
        if keyframes is not None:
            if len(keyframes.items) > 5:
                raise ValueError("Aleph2 supports at most 5 keyframes.")
            for item in keyframes.items:
                image_url = await upload_image_to_comfyapi(cls, item.image, mime_type="image/png")
                if item.mode == KEYFRAME_MODE_SECONDS:
                    _check_seconds(item.value, "Keyframe timestamp")
                    keyframe_models.append(RunwayAleph2KeyframeSeconds(seconds=item.value, uri=image_url))
                else:
                    keyframe_models.append(RunwayAleph2KeyframeAt(at=item.value, uri=image_url))

        prompt_image_models: list[RunwayAleph2PromptImage] = []
        if prompt_images is not None:
            if len(prompt_images.items) > 5:
                raise ValueError("Aleph2 supports at most 5 prompt images.")
            for item in prompt_images.items:
                image_url = await upload_image_to_comfyapi(cls, item.image, mime_type="image/png")
                position: RunwayAleph2TimestampPosition | RunwayAleph2RelativePosition
                if item.mode == PROMPT_IMAGE_MODE_TIMESTAMP:
                    _check_seconds(item.value, "Prompt image timestamp")
                    position = RunwayAleph2TimestampPosition(timestampSeconds=item.value)
                else:
                    position = RunwayAleph2RelativePosition(positionPercentage=item.value)
                prompt_image_models.append(RunwayAleph2PromptImage(position=position, uri=image_url))

        initial_response = await sync_op(
            cls,
            endpoint=ApiEndpoint(path=PATH_VIDEO_TO_VIDEO, method="POST"),
            response_model=RunwayAleph2Response,
            data=RunwayAleph2Request(
                promptText=prompt,
                videoUri=video_url,
                seed=seed,

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Reduce prompt_images to at most 5 items, keeping the most influential references
  2. Split the generation into multiple runs if more references are essential

Example fix

// before
aleph2(prompt, video, prompt_images=8_refs)

// after
aleph2(prompt, video, prompt_images=8_refs[:5])
Defensive patterns

Strategy: validation

Validate before calling

assert prompt_images is None or len(prompt_images.items) <= 5, "Aleph2: at most 5 prompt images"

Type guard

def prompt_image_count_ok(prompt_images) -> bool:
    return prompt_images is None or len(prompt_images.items) <= 5

Try / catch

try:
    await aleph2_execute(...)
except ValueError as e:
    if "at most 5 prompt images" in str(e):
        prompt_images.items = prompt_images.items[:5]
        await aleph2_execute(...)
    else:
        raise

Prevention

When it happens

Trigger: Connecting a prompt_images aggregation with 6+ items (each item = one image + timestamp or relative position) to the Aleph2 node.

Common situations: Style-reference-heavy workflows attaching many reference images along the timeline; reusing a keyframe-style aggregation for prompt images.

Related errors


AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14). Data as JSON: /api/errors/b15607573cc7ace9. Report an issue: GitHub.