FastAPI

UploadFile missing required file argument causes TypeError

critical
configurationUpdated Feb 27, 2026(via Exa)
How to detect:

UploadFile instantiation fails with TypeError if file argument is not provided. The file parameter became required in Starlette 0.24.0, breaking existing code that relied on automatic file creation.

Recommended action:

Update all UploadFile instantiations to explicitly pass a file argument. Create SpooledTemporaryFile and pass to UploadFile constructor. Search codebase with `grep -r "UploadFile" .` to find all usages. Test all file upload endpoints after changes.