# aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host api.example.com:443 ssl:default [Connect call failed]

- **ID:** `python/aiohttp-cannot-connect-to-host`
- **Domain:** python
- **Category:** network_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

DNS resolution or TCP connection to the target host failed, often due to network restrictions, wrong host/port, or firewall blocking outbound traffic.

## Version Compatibility

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

## Workarounds

1. **** (90% success)
   ```
   Configure a proxy if the environment requires one:

async with aiohttp.ClientSession() as s:
    async with s.get(url, proxy='http://proxy.local:8080') as r:
        ...
   ```
2. **** (85% success)
   ```
   Verify DNS and connectivity first:

import socket
socket.gethostbyname('api.example.com')
# then retry with aiodns resolver if needed
   ```

## Dead Ends

- **** — Connection is refused or unreachable; a longer timeout only delays the same error. (80% fail)
- **** — The failure occurs before the TLS handshake; ssl=False does not help when TCP connect fails. (85% fail)
