Comfy-Org/ComfyUI · error · ValueError

Task creation fails with code={initial_res.code} and message

Error message

Task creation fails with code={initial_res.code} and message={initial_res.message}

What it means

Raised by WavespeedFlashVSRNode.execute when the WaveSpeed FlashVSR task-creation POST to /proxy/wavespeed/api/v3/wavespeed-ai/flashvsr returns a non-200 `code` in its body. TaskCreatedResponse (comfy_api_nodes/apis/wavespeed.py:21) carries an integer code and message; any value other than 200 means the task was never created.

Source

Thrown at comfy_api_nodes/nodes_wavespeed.py:80

    async def execute(
        cls,
        video: Input.Video,
        target_resolution: str,
    ) -> IO.NodeOutput:
        validate_container_format_is_mp4(video)
        validate_video_duration(video, min_duration=5, max_duration=60 * 10)
        initial_res = await sync_op(
            cls,
            ApiEndpoint(path="/proxy/wavespeed/api/v3/wavespeed-ai/flashvsr", method="POST"),
            response_model=TaskCreatedResponse,
            data=FlashVSRRequest(
                target_resolution=target_resolution.lower(),
                video=await upload_video_to_comfyapi(cls, video),
                duration=video.get_duration(),
            ),
        )
        if initial_res.code != 200:
            raise ValueError(f"Task creation fails with code={initial_res.code} and message={initial_res.message}")
        final_response = await poll_op(
            cls,
            ApiEndpoint(path=f"/proxy/wavespeed/api/v3/predictions/{initial_res.data.id}/result"),
            response_model=TaskResultResponse,
            status_extractor=lambda x: "failed" if x.data is None else x.data.status,
            poll_interval=10.0,
        )
        if final_response.code != 200:
            raise ValueError(
                f"Task processing failed with code={final_response.code} and message={final_response.message}"
            )
        return IO.NodeOutput(await download_url_to_video_output(final_response.data.outputs[0]))


class WavespeedImageUpscaleNode(IO.ComfyNode):
    @classmethod
    def define_schema(cls):
        return IO.Schema(

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Read code and message from the exception — they come straight from WaveSpeed
  2. Use a supported target_resolution value (uppercase display strings are lowercased; verify the exact allowed set)
  3. Re-upload a freshly encoded H.264/MP4 clip and retry
  4. Check WaveSpeed API key/quota and the service status page; retry once if transient
Defensive patterns

Strategy: retry

Validate before calling

ALLOWED = {"720p", "1080p", "4k"}  # confirm against current FlashVSR docs
if target_resolution.lower() not in ALLOWED:
    raise ValueError(f"unsupported target_resolution: {target_resolution}")

Try / catch

try:
    ...await execute(...)
except ValueError as e:
    if "Task creation fails" in str(e):
        retry_with_backoff(...)  # creation failures are often transient upstream

Prevention

When it happens

Trigger: FlashVSR creation fails server-side: target_resolution not in the accepted set, uploaded video URL rejected, duration metadata inconsistent, invalid API key/quota for the WaveSpeed account behind the proxy, or upstream outage.

Common situations: Typo'd or unsupported target_resolution; source video re-encoded in a format WaveSpeed rejects; expired WaveSpeed credentials; service incidents returning error codes with 200-level transport.

Related errors


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