{"record":{"id":"4fc12ef7f93542a1","repo":"Comfy-Org/ComfyUI","slug":"unsupported-media-type","errorCode":"UNSUPPORTED_MEDIA_TYPE","errorMessage":"Use multipart/form-data for uploads.","messagePattern":"Use multipart/form-data for uploads\\.","errorType":"http","errorClass":"UploadError","httpStatus":415,"severity":"error","filePath":"app/assets/api/upload.py","lineNumber":42,"sourceCode":"async def parse_multipart_upload(\n    request: web.Request,\n    check_hash_exists: Callable[[str], bool],\n) -> ParsedUpload:\n    \"\"\"\n    Parse a multipart/form-data upload request.\n\n    Args:\n        request: The aiohttp request\n        check_hash_exists: Callable(hash_str) -> bool to check if a hash exists\n\n    Returns:\n        ParsedUpload with parsed fields and temp file path\n\n    Raises:\n        UploadError: On validation or I/O errors\n    \"\"\"\n    if not (request.content_type or \"\").lower().startswith(\"multipart/\"):\n        raise UploadError(\n            415, \"UNSUPPORTED_MEDIA_TYPE\", \"Use multipart/form-data for uploads.\"\n        )\n\n    reader = await request.multipart()\n\n    file_present = False\n    file_client_name: str | None = None\n    tags_raw: list[str] = []\n    provided_name: str | None = None\n    user_metadata_raw: str | None = None\n    provided_hash: str | None = None\n    provided_hash_exists: bool | None = None\n    provided_mime_type: str | None = None\n    provided_preview_id: str | None = None\n\n    file_written = 0\n    tmp_path: str | None = None\n","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/app/assets/api/upload.py#L24-L60","documentation":"Raised from the HTTP >=400 branch (comfy_api_nodes/util/client.py:823) via _friendly_http_message when the error body is a JSON dict with an error object containing both 'message' and 'type' fields. The message embeds the provider's own error text and machine-readable type, e.g. validation failures, invalid parameters, or provider-side processing errors.","triggerScenarios":"Sending invalid/oversized parameters to a provider endpoint (bad resolution, missing required field, unsupported model name); content rejected by provider validation; any 4xx/5xx whose body follows the {\"error\": {\"message\", \"type\"}} shape.","commonSituations":"Node parameter mismatches after a provider API update; user-entered values (dimensions, seeds, model ids) outside allowed ranges; changed required fields.","solutions":["Read the embedded message and type — they state exactly which parameter or condition failed","Correct the offending input per the provider's error text and rerun","Cross-check the node's parameter definitions against the provider's current API docs if the error persists","Check the logged full response body for extra fields beyond message/type"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import json\ndef validate_generation_params(p):\n    assert 64 <= p.width <= 2048 and 64 <= p.height <= 2048, \"size out of range\"\n    assert p.model in SUPPORTED_MODELS, \"unknown model id\"","typeGuard":null,"tryCatchPattern":"try:\n    result = await sync_op(...)\nexcept Exception as e:\n    m = re.match(r\"API Error: (.+) \\(Type: (.+)\\)\", str(e))\n    if m and m.group(2) == \"invalid_request_error\":\n        fix_param(m.group(1))\n    else:\n        raise","preventionTips":["Validate node inputs against provider docs before submission","Branch on the structured (Type:) field rather than the human message text"],"tags":["http-4xx","validation","provider","http"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}