{"record":{"id":"3f04db13f8b61f0b","repo":"Comfy-Org/ComfyUI","slug":"upload-cancelled","errorCode":null,"errorMessage":"Upload cancelled","messagePattern":"Upload cancelled","errorType":"exception","errorClass":"ProcessingInterrupted","httpStatus":null,"severity":"warning","filePath":"comfy_api_nodes/util/upload_helpers.py","lineNumber":303,"sourceCode":"        try:\n            request_logger.log_request_response(\n                operation_id=operation_id,\n                request_method=\"PUT\",\n                request_url=upload_url,\n                request_headers=headers or None,\n                request_params=None,\n                request_data=f\"[File data {len(data)} bytes]\",\n            )\n\n            sess = aiohttp.ClientSession(timeout=timeout)\n            req = sess.put(upload_url, data=data, headers=headers, skip_auto_headers=skip_auto_headers)\n            req_task = asyncio.create_task(req)\n\n            done, pending = await asyncio.wait({req_task, monitor_task}, return_when=asyncio.FIRST_COMPLETED)\n\n            if monitor_task in done and req_task in pending:\n                req_task.cancel()\n                raise ProcessingInterrupted(\"Upload cancelled\")\n\n            try:\n                resp = await req_task\n            except asyncio.CancelledError:\n                raise ProcessingInterrupted(\"Upload cancelled\") from None\n\n            async with resp:\n                if resp.status >= 400:\n                    with contextlib.suppress(Exception):\n                        try:\n                            body = await resp.json()\n                        except Exception:\n                            body = await resp.text()\n                        msg = f\"Upload failed with status {resp.status}\"\n                        request_logger.log_request_response(\n                            operation_id=operation_id,\n                            request_method=\"PUT\",\n                            request_url=upload_url,","sourceCodeStart":285,"sourceCodeEnd":321,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_api_nodes/util/upload_helpers.py#L285-L321","documentation":"Raised as ProcessingInterrupted when an in-flight file upload (aiohttp PUT to a presigned upload_url) is abandoned because the interrupt monitor task finished first. upload_helpers.py races the PUT request against a monitor task via asyncio.wait(FIRST_COMPLETED); when the monitor wins while the request is still pending, the request task is cancelled and this error surfaces. It is ComfyUI's standard signal that the user or runtime cancelled processing mid-upload, not a network failure.","triggerScenarios":"Calling upload_file_to_api_file_upload_url (or wrappers like upload_images_to_comfyapi / upload_image_to_comfyapi) and triggering processing_interrupted() (e.g., pressing Cancel in the ComfyUI queue) while the PUT is still streaming; the monitor task completes, req_task is pending, req_task.cancel() runs, and ProcessingInterrupted('Upload cancelled') is raised at upload_helpers.py:303.","commonSituations":"User hits Cancel on a long image/video upload to a ComfyUI API node; a workflow is interrupted from the UI or API while an api_nodes upload is in progress; a timeout monitor fires during a slow upload of a large video file.","solutions":["Treat this as an expected cancellation, not a bug: catch ProcessingInterrupted in the node/caller and stop the work cleanly without retrying.","If uploads are cancelled unexpectedly, check whether your own code or an integration is calling processing_interrupted() or cancelling the queue item.","If it fires spuriously during slow uploads of large files, reduce the payload size (e.g., lower total_pixels for images) or improve upstream bandwidth before retrying the workflow."],"exampleFix":"// before\nurl = await upload_image_to_comfyapi(cls, image)\n// after\nfrom comfy_api_nodes.util.common_exceptions import ProcessingInterrupted\ntry:\n    url = await upload_image_to_comfyapi(cls, image)\nexcept ProcessingInterrupted:\n    logging.info(\"Upload cancelled by user\")\n    raise","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"from comfy_api_nodes.util.common_exceptions import ProcessingInterrupted\ntry:\n    urls = await upload_images_to_comfyapi(cls, images)\nexcept ProcessingInterrupted:\n    # user/runtime cancel: stop cleanly, do not retry\n    raise","preventionTips":["Let cancellation propagate; never wrap uploads in a blanket retry loop","Keep uploads short (smaller payloads) to narrow the cancel window"],"tags":["async","cancellation","upload","comfyui"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}