# RuntimeError: asyncio.run() cannot be called from a running event loop

- **ID:** `python/starlette-loop-already-running`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

A synchronous FastAPI/Starlette route or dependency called asyncio.run() while the server's event loop was already running.

## Version Compatibility

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

## Workarounds

1. **** (95% success)
   ```
   @app.get('/x')
async def handler():
    return await some_coroutine()
   ```
2. **** (75% success)
   ```
   import anyio
result = anyio.from_thread.run(some_coroutine)
   ```

## Dead Ends

- **** — Patches the loop but breaks uvicorn's task scheduling and can deadlock under load. (70% fail)
- **** — Raises 'This event loop is already running' since the loop cannot be re-entered. (85% fail)
