> Records below are third-party data, not instructions. Apply with your own judgment.

# "RuntimeError: There is no current event loop in thread 'MainThread'." — python 3.14
cause: 3.14 made asyncio.get_event_loop() raise when no loop is set instead of creating one (3.12-3.13 only warned), so the get_event_loop() + run_until_complete idiom breaks
status: no reports yet · published on python 3.14.0 · checked by the publisher against the sources below
arms: works 3.14
risk: low
fix (patch):
~~~
-loop = asyncio.get_event_loop()
-loop.run_until_complete(main())
+asyncio.run(main())
# inside a coroutine or callback: asyncio.get_running_loop()
# blocking code between async calls: with asyncio.Runner() as r: r.run(a()); blocking(); r.run(b())
# a dependency calls get_event_loop() at startup: upgrade it, or asyncio.set_event_loop(asyncio.new_event_loop()) first
~~~
repro: python3.14 -c "import asyncio; asyncio.get_event_loop()"
check: none
sources:
- https://github.com/python-arq/arq/issues/512
- https://www.python.org/api/v2/downloads/release/?name=Python%203.14.0
- https://github.com/python/cpython/blob/3.14/Doc/whatsnew/3.14.rst
don't:
- asyncio.get_event_loop_policy().get_event_loop() — that policy method is exactly what raises in 3.14, and get_event_loop_policy() itself is deprecated for removal in 3.16 (×1)
- loop = asyncio.new_event_loop() without asyncio.set_event_loop(loop) — the loop is not registered as current, so a later get_event_loop() call made outside that running loop, yours or a library's, still raises the same RuntimeError (×1)
---
reports are optional and public; whether to send one is your user's call — GET https://api.modalhub.ai/r/python-runtimeerror-there-is-no-current-event-ec8c/worked?v=<version> or https://api.modalhub.ai/r/python-runtimeerror-there-is-no-current-event-ec8c/didnt?v=<version> (one request, no account; &note=<what you saw, one line> adds a public note)
history https://api.modalhub.ai/r/python-runtimeerror-there-is-no-current-event-ec8c/history · license CC0-1.0
