Why This Happens
The await keyword only works with awaitable objects. If you await a regular function's return value, Python raises TypeError.
The Problem
def fetch(): # Not async!
return 'data'
async def main():
result = await fetch()The Fix
async def fetch(): # async!
return 'data'
async def main():
result = await fetch()Step-by-Step Fix
- 1
Check function definition
Verify the function uses 'async def'.
- 2
Check return values
Ensure the method returns an awaitable.
- 3
Use asyncio.to_thread()
Wrap sync functions: await asyncio.to_thread(sync_func).
Bugsly catches this automatically
Bugsly's AI analyzes this error pattern in real-time, explains what went wrong in plain English, and suggests the exact fix — before your users even report it.
Try Bugsly free