Comfy-Org/ComfyUI · error · ValueError

Failed to upload one or more images to comfy api.

Error message

Failed to upload one or more images to comfy api.

What it means

Raised by the Runway first/last frame node when upload_images_to_comfyapi returns fewer than 2 download URLs for the 2 stacked frames (start + end). The upload helper may silently skip images that exceed its max_images or fail partway, so the count check is the only signal that the upload was incomplete. Execution stops before the generation request is built.

Source

Thrown at comfy_api_nodes/nodes_runway.py:421

        duration: str,
        ratio: str,
        seed: int,
    ) -> IO.NodeOutput:
        validate_string(prompt, min_length=1)
        validate_image_dimensions(start_frame, max_width=7999, max_height=7999)
        validate_image_dimensions(end_frame, max_width=7999, max_height=7999)
        validate_image_aspect_ratio(start_frame, (1, 2), (2, 1))
        validate_image_aspect_ratio(end_frame, (1, 2), (2, 1))

        stacked_input_images = image_tensor_pair_to_batch(start_frame, end_frame)
        download_urls = await upload_images_to_comfyapi(
            cls,
            stacked_input_images,
            max_images=2,
            mime_type="image/png",
        )
        if len(download_urls) != 2:
            raise ValueError("Failed to upload one or more images to comfy api.")

        return IO.NodeOutput(
            await generate_video(
                cls,
                RunwayImageToVideoRequest(
                    promptText=prompt,
                    seed=seed,
                    model=Model("gen3a_turbo"),
                    duration=Duration(duration),
                    ratio=AspectRatio(ratio),
                    promptImage=RunwayPromptImageObject(
                        root=[
                            RunwayPromptImageDetailedObject(uri=str(download_urls[0]), position="first"),
                            RunwayPromptImageDetailedObject(uri=str(download_urls[1]), position="last"),
                        ]
                    ),
                ),
                estimated_duration=AVERAGE_DURATION_FLF_SECONDS,

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Retry the node — transient upload failures are the most common cause
  2. Verify API credentials/session for the ComfyAPI upload endpoint are valid
  3. Check network connectivity and any proxy that could truncate multipart uploads
  4. Confirm each input is a single image (not an empty or zero-batch tensor)
Defensive patterns

Strategy: retry

Validate before calling

from comfy_api_nodes.utils import get_number_of_images
assert get_number_of_images(start_frame) == 1, "start_frame must be one image"
assert get_number_of_images(end_frame) == 1, "end_frame must be one image"

Try / catch

try:
    await runway_first_last_frame(...)
except ValueError as e:
    if "Failed to upload" in str(e):
        await asyncio.sleep(2)
        await runway_first_last_frame(...)  # one retry
    else:
        raise

Prevention

When it happens

Trigger: Calling RunwayFirstLastFrameNode with start_frame and end_frame where upload_images_to_comfyapi(cls, stacked_input_images, max_images=2) returns 0 or 1 URLs (partial upload failure, helper truncation, or an upload exception swallowed upstream).

Common situations: Flaky network to the ComfyUI API upload endpoint; auth/token expiry mid-upload; upstream changes to upload_images_to_comfyapi dropping frames from batched tensors.

Related errors


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