# aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host api.example.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1006)')]

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

## Root Cause

The client cannot find the CA bundle to verify the server certificate, often on macOS Python.org builds or in containers missing ca-certificates.

## Version Compatibility

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

## Workarounds

1. **** (95% success)
   ```
   import ssl, certifi, aiohttp
ctx = ssl.create_default_context(cafile=certifi.where())
conn = aiohttp.TCPConnector(ssl=ctx)
async with aiohttp.ClientSession(connector=conn) as s:
    ...
   ```
2. **** (90% success)
   ```
   # macOS
/Applications/Python\ 3.12/Install\ Certificates.command
   ```

## Dead Ends

- **** — Disables TLS verification entirely, exposing the app to MITM; often blocked by security policy. (40% fail)
- **** — The issue is the system trust store, not the aiohttp package. (90% fail)
