Comfy-Org/ComfyUI · error · ValueError

Task processing failed with code={final_response.code} and m

Error message

Task processing failed with code={final_response.code} and message={final_response.message}

What it means

Raised by WavespeedFlashVSRNode.execute after polling completes with a final result whose `code` is not 200. The poll status_extractor treats `data is None` as "failed", so this fires when the FlashVSR task itself failed during processing rather than at creation time.

Source

Thrown at comfy_api_nodes/nodes_wavespeed.py:89

            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(
            node_id="WavespeedImageUpscaleNode",
            display_name="WaveSpeed Image Upscale",
            category="partner/image/WaveSpeed",
            description="Boost image resolution and quality, upscaling photos to 4K or 8K for sharp, detailed results.",
            inputs=[
                IO.Combo.Input("model", options=["SeedVR2", "Ultimate"]),
                IO.Image.Input("image"),
                IO.Combo.Input("target_resolution", options=["2K", "4K", "8K"]),
            ],

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Read the final code/message for the processing failure reason
  2. Re-encode the source video (standard H.264 MP4, faststart) and retry
  3. Trim the video below the 10-minute max (validate_video_duration already enforces 5s–10min) to reduce processing failure surface
  4. Retry once; if it persists, check WaveSpeed status or try a shorter/lower-resolution clip
Defensive patterns

Strategy: retry

Validate before calling

validate_video_duration(video, min_duration=5, max_duration=600)  # already enforced by the node; keep source well inside limits

Try / catch

try:
    ...await execute(...)
except ValueError as e:
    if "Task processing failed" in str(e):
        reencode_and_retry(video)  # mid-processing failures often stem from the source encoding

Prevention

When it happens

Trigger: The polled prediction result endpoint returns an error body: the job crashed upstream, the video was rejected mid-processing (corrupt stream, unsupported codec parameters), or the task was killed for policy/quota reasons after creation succeeded.

Common situations: Source video with unusual codec flags or truncated moov atom that passes initial upload but fails decoding upstream; long videos hitting processing timeouts; WaveSpeed GPU capacity issues.

Related errors


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