python
runtime_error
ai_generated
true
RuntimeWarning: coroutine 'get_data' was never awaited
ID: python/fastapi-await-missing
80%Fix Rate
89%Confidence
0Evidence
2024-07-29First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.x | active | — | — | — |
Root Cause
An async function was called without await inside an async route, so the coroutine object was returned instead of data.
generic中文
在异步路由中调用异步函数时未使用 await,导致返回协程对象而非数据。
Workarounds
-
95% success
data = await get_data()
-
85% success
Make route sync def and call sync version of helper
Dead Ends
Common approaches that don't work:
-
85% fail
Cannot run event loop inside a running loop; raises RuntimeError.
-
80% fail
Silences signal but response body is still a coroutine.