# aiohttp.client_exceptions.ClientResponseError: 429, message='Too Many Requests', url=URL('https://api.example.com/v1/items')

- **ID:** `python/aiohttp-client-response-error`
- **Domain:** python
- **Category:** network_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The remote server returned a 4xx/5xx status and the session/request was configured with raise_for_status=True, so aiohttp raised ClientResponseError instead of returning the response.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.8 | active | — | — |
| 3.9 | active | — | — |
| 3.10 | active | — | — |
| 3.11 | active | — | — |
| 3.12 | active | — | — |

## Workarounds

1. **** (88% success)
   ```
   import asyncio, random
for attempt in range(5):
    async with session.get(url) as r:
        if r.status == 429:
            await asyncio.sleep((2 ** attempt) + random.random())
            continue
        r.raise_for_status()
        return await r.json()
   ```
2. **** (90% success)
   ```
   sem = asyncio.Semaphore(5)
async def fetch(u):
    async with sem:
        async with session.get(u) as r:
            r.raise_for_status()
            return await r.json()
   ```

## Dead Ends

- **** — Hides 5xx and auth failures; downstream code receives HTML error pages parsed as JSON. (75% fail)
- **** — Aggravates rate limiting and often escalates to a 403 block. (85% fail)
