# RuntimeError: Session is closed

- **ID:** `python/aiohttp-session-outside-context`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

An aiohttp.ClientSession was used after exiting its async with block (which calls close()), or after session.close() was awaited.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.9+ | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   async with aiohttp.ClientSession() as session:
    async with session.get(url) as r:
        data = await r.text()
    async with session.get(url2) as r2:
        ...
   ```
2. **** (90% success)
   ```
   session = aiohttp.ClientSession()
try:
    async with session.get(url) as r:
        ...
finally:
    await session.close()
   ```

## Dead Ends

- **** — The context manager closes the session on exit; reusing it always raises. (90% fail)
- **** — Closed sessions cannot issue new requests; the connector is shut down. (95% fail)
