{"record":{"id":"f598e2be61b26a3f","repo":"Comfy-Org/ComfyUI","slug":"failed-to-upload-http-resp-status","errorCode":null,"errorMessage":"Failed to upload (HTTP {resp.status}).","messagePattern":"Failed to upload \\(HTTP (.+?)\\)\\.","errorType":"http","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"comfy_api_nodes/util/upload_helpers.py","lineNumber":338,"sourceCode":"                            request_method=\"PUT\",\n                            request_url=upload_url,\n                            response_status_code=resp.status,\n                            response_headers=dict(resp.headers),\n                            response_content=body,\n                            error_message=msg,\n                        )\n                    if resp.status in {408, 429, 500, 502, 503, 504} and attempt <= max_retries:\n                        await sleep_with_interrupt(\n                            delay,\n                            cls,\n                            wait_label,\n                            start_ts,\n                            None,\n                            display_callback=_display_time_progress if wait_label else None,\n                        )\n                        delay *= retry_backoff\n                        continue\n                    raise Exception(f\"Failed to upload (HTTP {resp.status}).\")\n                request_logger.log_request_response(\n                    operation_id=operation_id,\n                    request_method=\"PUT\",\n                    request_url=upload_url,\n                    response_status_code=resp.status,\n                    response_headers=dict(resp.headers),\n                    response_content=\"File uploaded successfully.\",\n                )\n                return\n        except asyncio.CancelledError:\n            raise ProcessingInterrupted(\"Task cancelled\") from None\n        except (aiohttp.ClientError, OSError) as e:\n            if attempt <= max_retries:\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,","sourceCodeStart":320,"sourceCodeEnd":356,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_api_nodes/util/upload_helpers.py#L320-L356","documentation":"Generic Exception raised when the PUT to upload_url returns an HTTP status >= 400 that is either non-retryable or occurs after retries are exhausted. Retryable statuses {408, 429, 500, 502, 503, 504} are retried up to max_retries with exponential backoff; anything else (or a final failure) raises 'Failed to upload (HTTP {status}).'. The response body/error is logged via request_logger before raising.","triggerScenarios":"Presigned upload_url returns 403 (expired/signed URL), 410, 400 (bad Content-Type header), or a retryable 5xx that persists past max_retries; resp.status >= 400 and the retry condition (status in {408,429,500,502,503,504} and attempt <= max_retries) is false, so raise Exception at upload_helpers.py:338.","commonSituations":"Stale presigned URL because the upload request was queued long after the API issued it; wrong Content-Type header vs the signed URL's constraint; provider outage (persistent 502/503); rate limiting (429) exhausting retries; very large uploads exceeding the provider's size limit with a 400.","solutions":["Re-run the node/workflow so a fresh upload_url is minted — expired presigned URLs are the most common cause of 403.","Check request_logger output (operation_id entries) for the exact status and body to identify the provider-side reason.","Match the Content-Type passed to the upload to what the API instructed (do not override mime_type arbitrarily).","For 429/5xx, retry after a longer wait or reduce upload frequency; for oversized files, shrink the payload (e.g., lower total_pixels)."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    url = await upload_image_to_comfyapi(cls, image)\nexcept Exception as e:\n    if \"Failed to upload (HTTP 403)\" in str(e):\n        # expired presigned URL: re-run to mint a new one\n        url = await upload_image_to_comfyapi(cls, image)","preventionTips":["Re-run the workflow to get a fresh presigned URL instead of reusing cached ones","Pass the exact Content-Type the API instructed","Check request_logger output for the status and body before guessing"],"tags":["http","upload","retry","api-nodes"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}