# RuntimeError: no running event loop

- **ID:** `python/asyncio-no-running-event-loop`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

asyncio.get_running_loop() or an await was executed outside an active event loop, typically from synchronous code or a thread that never entered asyncio.run().

## 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)
   ```
   async def main():
    ...

if __name__ == '__main__':
    asyncio.run(main())
   ```
2. **** (90% success)
   ```
   loop = main_loop  # captured earlier
future = asyncio.run_coroutine_threadsafe(coro(), loop)
result = future.result(timeout=10)
   ```

## Dead Ends

- **** — In Python 3.10+ this raises DeprecationWarning and in 3.12 raises RuntimeError when no loop exists. (70% fail)
- **** — No loop will spontaneously appear; the coroutine never runs. (90% fail)
