# aiohttp.client_exceptions.TooManyRedirects: Exceeded 30 redirects

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

## Root Cause

The server is redirecting the client in a loop or too many times, exceeding the default redirect limit.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.10 | active | — | — |
| 3.11 | active | — | — |

## Workarounds

1. **Set max_redirects to a reasonable limit and handle redirect loops** (85% success)
   ```
   async with session.get(url, max_redirects=5) as resp:
    # process response
   ```
2. **Disable automatic redirects and handle manually with loop detection** (80% success)
   ```
   async with session.get(url, allow_redirects=False) as resp:
    if resp.status in (301, 302):
        new_url = resp.headers['Location']
        # check for loop before following
   ```

## Dead Ends

- **Increasing the max redirects to a very high number** — This may cause infinite loops or resource exhaustion. (50% fail)
- **Following redirects manually without checking for loops** — Manual following may still get stuck in a redirect loop. (60% fail)
