# DeprecationWarning: There is no current event loop

- **ID:** `python/asyncio-loop-policy-deprecated`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

asyncio.get_event_loop() was called with no running loop and no loop set for the current thread; Python 3.10+ deprecates this behavior and 3.12+ warns.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.10 | active | — | — |
| 3.11 | active | — | — |
| 3.12 | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   Inside async code, use asyncio.get_running_loop():

loop = asyncio.get_running_loop()
   ```
2. **** (90% success)
   ```
   From sync code, use asyncio.new_event_loop() and manage lifetime explicitly:

loop = asyncio.new_event_loop()
try:
    loop.run_until_complete(coro())
finally:
    loop.close()
   ```
3. **** (92% success)
   ```
   Use asyncio.Runner (3.11+) for repeated runs:

with asyncio.Runner() as runner:
    runner.run(coro())
   ```

## Dead Ends

- **** — Hides the warning but the underlying API will be removed in 3.14. (70% fail)
- **** — Creates a loop that is never closed; leaks resources and causes 'loop is closed' errors later. (65% fail)
- **** — Not a maintainable fix; 3.9 is EOL in Oct 2025. (90% fail)
