# starlette.exceptions.HTTPException: 413: Request Entity Too Large

- **ID:** `python/starlette-upload-file-size-limit`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Uploaded file exceeds the maximum upload size limit set in the server configuration.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.x | active | — | — |

## Workarounds

1. **** (70% success)
   ```
   Set a custom limit in uvicorn: uvicorn.run(app, limit_max_request_size=1000000) for 1MB
   ```
2. **** (90% success)
   ```
   Use a middleware to check content-length and reject early with a custom message
   ```

## Dead Ends

- **** — Uvicorn doesn't have a direct setting; you need to configure the ASGI server or use a middleware. (80% fail)
- **** — This handles the error but doesn't allow the upload; you need to increase the limit. (50% fail)
