python
network_error
ai_generated
true
starlette.formparsers.MultiPartException: Missing boundary in multipart.
ID: python/starlette-missing-boundary-multipart
80%Fix Rate
85%Confidence
0Evidence
2024-06-18First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.x | active | — | — | — |
Root Cause
A multipart/form-data request lacks the boundary parameter in its Content-Type header, or the client sends a body without the header.
generic中文
multipart/form-data 请求的 Content-Type 头缺少 boundary 参数,或客户端发送了请求体却没有该头。
Workarounds
-
95% success
import requests files = {'file': open('a.png', 'rb')} requests.post(url, files=files) -
92% success
from fastapi import File, UploadFile @app.post('/upload') async def upload(file: UploadFile = File(...)): ...
Dead Ends
Common approaches that don't work:
-
80% fail
The endpoint expects form fields and fails validation.
-
70% fail
Does not fix the client; uploads keep failing.