python
async_error
ai_generated
true
RuntimeWarning: coroutine 'func' was never awaited
ID: python/runtimeerror-coroutine-never-awaited
95%Fix Rate
95%Confidence
50Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 311 | active | — | — | — |
Root Cause
Called async function without await. Returns a coroutine object, doesn't execute.
genericWorkarounds
-
98% success Add await keyword: result = await async_function()
result = await async_function()
Sources: https://docs.python.org/3/library/asyncio-task.html#coroutines
-
90% success If calling from sync code, use asyncio.run(async_function())
async_function(
Sources: https://docs.python.org/3/library/asyncio-runner.html#asyncio.run
Dead Ends
Common approaches that don't work:
-
Wrap in asyncio.ensure_future()
55% fail
Works but less readable — just use await
Error Chain
Frequently confused with: