# asyncio.exceptions.TimeoutError: Request timed out

- **ID:** `python/starlette-request-client-timeout`
- **Domain:** python
- **Category:** network_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The server takes longer than the client's timeout to respond, often due to slow database queries or external API calls within the endpoint.

## Version Compatibility

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

## Workarounds

1. **** (90% success)
   ```
   Optimize the endpoint by adding caching, using async database drivers, or offloading heavy tasks to background workers.
   ```
2. **** (85% success)
   ```
   Implement server-side timeouts and return a 504 Gateway Timeout if the operation takes too long.
   ```

## Dead Ends

- **** — Increasing client timeout doesn't fix the root cause; the server still processes slowly. (80% fail)
- **** — Retrying the request may eventually succeed but is inefficient and can overload the server. (70% fail)
