{"record":{"id":"8a480c267d20961c","repo":"BerriAI/litellm","slug":"field-must-be-provided-as-a-multipart-file-up","errorCode":null,"errorMessage":"'{_field}' must be provided as a multipart file upload, not a string.","messagePattern":"'(.+?)' must be provided as a multipart file upload, not a string\\.","errorType":"http","errorClass":"HTTPException","httpStatus":422,"severity":"error","filePath":"litellm/proxy/image_endpoints/endpoints.py","lineNumber":291,"sourceCode":"        user_request_timeout,\n        user_temperature,\n        version,\n    )\n\n    #########################################################\n    # Read request body and convert UploadFiles to BytesIO\n    #########################################################\n    data: Final = await _read_request_body(request=request)\n    image_files: Final = await batch_to_bytesio(image)\n    mask_files: Final = await batch_to_bytesio(mask)\n    if image_files:\n        data[\"image\"] = image_files\n    if mask_files:\n        data[\"mask\"] = mask_files\n\n    for _field in (\"image\", \"mask\"):\n        if _field in data and isinstance(data[_field], str):\n            raise HTTPException(\n                status_code=422,\n                detail=f\"'{_field}' must be provided as a multipart file upload, not a string.\",\n            )\n\n    # Ensure prompt exists in data (default to None for models that don't require it)\n    if \"prompt\" not in data:\n        data[\"prompt\"] = None\n\n    data[\"model\"] = (\n        model\n        or general_settings.get(\"image_generation_model\", None)  # server default\n        or user_model  # model name passed via cli args\n        or data.get(\"model\", None)  # default passed in http request\n    )\n    #########################################################\n    # Process request\n    #########################################################\n","sourceCodeStart":273,"sourceCodeEnd":309,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/image_endpoints/endpoints.py#L273-L309","documentation":"Error \"'{_field}' must be provided as a multipart file upload, not a string.\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/proxy/image_endpoints/endpoints.py:291 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Upload the field as a multipart file instead of a string value.","Use a multipart/form-data request with the file attached under the named field."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}