{"record":{"id":"963e50beef9d4dbc","repo":"Comfy-Org/ComfyUI","slug":"task-processing-failed-with-code-final-response-c","errorCode":null,"errorMessage":"Task processing failed with code={final_response.code} and message={final_response.message}","messagePattern":"Task processing failed with code=(.+?) and message=(.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_api_nodes/nodes_wavespeed.py","lineNumber":89,"sourceCode":"            ApiEndpoint(path=\"/proxy/wavespeed/api/v3/wavespeed-ai/flashvsr\", method=\"POST\"),\n            response_model=TaskCreatedResponse,\n            data=FlashVSRRequest(\n                target_resolution=target_resolution.lower(),\n                video=await upload_video_to_comfyapi(cls, video),\n                duration=video.get_duration(),\n            ),\n        )\n        if initial_res.code != 200:\n            raise ValueError(f\"Task creation fails with code={initial_res.code} and message={initial_res.message}\")\n        final_response = await poll_op(\n            cls,\n            ApiEndpoint(path=f\"/proxy/wavespeed/api/v3/predictions/{initial_res.data.id}/result\"),\n            response_model=TaskResultResponse,\n            status_extractor=lambda x: \"failed\" if x.data is None else x.data.status,\n            poll_interval=10.0,\n        )\n        if final_response.code != 200:\n            raise ValueError(\n                f\"Task processing failed with code={final_response.code} and message={final_response.message}\"\n            )\n        return IO.NodeOutput(await download_url_to_video_output(final_response.data.outputs[0]))\n\n\nclass WavespeedImageUpscaleNode(IO.ComfyNode):\n    @classmethod\n    def define_schema(cls):\n        return IO.Schema(\n            node_id=\"WavespeedImageUpscaleNode\",\n            display_name=\"WaveSpeed Image Upscale\",\n            category=\"partner/image/WaveSpeed\",\n            description=\"Boost image resolution and quality, upscaling photos to 4K or 8K for sharp, detailed results.\",\n            inputs=[\n                IO.Combo.Input(\"model\", options=[\"SeedVR2\", \"Ultimate\"]),\n                IO.Image.Input(\"image\"),\n                IO.Combo.Input(\"target_resolution\", options=[\"2K\", \"4K\", \"8K\"]),\n            ],","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_api_nodes/nodes_wavespeed.py#L71-L107","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the final code/message for the processing failure reason","Re-encode the source video (standard H.264 MP4, faststart) and retry","Trim the video below the 10-minute max (validate_video_duration already enforces 5s–10min) to reduce processing failure surface","Retry once; if it persists, check WaveSpeed status or try a shorter/lower-resolution clip"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"validate_video_duration(video, min_duration=5, max_duration=600)  # already enforced by the node; keep source well inside limits","typeGuard":null,"tryCatchPattern":"try:\n    ...await execute(...)\nexcept ValueError as e:\n    if \"Task processing failed\" in str(e):\n        reencode_and_retry(video)  # mid-processing failures often stem from the source encoding","preventionTips":["Encode with H.264, faststart, intact moov atom","Keep durations well under the 10-minute ceiling","Retry once with a re-encoded source before escalating"],"tags":["wavespeed","api-node","polling","upstream-error","video-upscale"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}