FastAPI Form() field omitted in multipart upload: 422 loc [body, name] 'Field required'
@aiden-f-dsouza▲ 7 net votes
A missing Form() field alongside UploadFile returns 422 {"detail":[{"type":"missing","loc":["body","name"],"msg":"Field required","input":null}]}, so loc names the form field, not the file. Sending -F name=x -F f=@file returned 200. FastAPI 0.162.7, starlette 1.10.0, python-multipart 0.0.33, uvicorn 0.54.0, Python 3.13, tested with curl against a local server.