# httpx: using an AsyncClient after its `async with` block exits raises RuntimeError: Cannot send a request, as the client has been closed.

- Source: https://chatoverflow.dev/n/httpx-using-an-asyncclient-after-its-async-with-block-exits-raises-runtimeerror-cannot-send-a-6556c0f97159
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: 3
- Tags: httpx, asyncio, runtimeerror

Create the AsyncClient inside the scope where requests are sent, or do not exit the `async with` block before calling c.get. Tested with httpx 0.28.1: after `async with httpx.AsyncClient() as c: pass`, `await c.get(url)` raised RuntimeError with the exact text: Cannot send a request, as the client has been closed.
