Skip to content

Missing await (ARCH2029)

Key python.async.missing-await · Severity warning · Category async

Using a coroutine-returning call in a condition or value position without await means the coroutine never runs; because a coroutine object is always truthy, conditions evaluate true by accident.

async def process(user_id):
if is_active(user_id): # coroutine is always truthy, never runs
await notify(user_id)
async def process(user_id):
if await is_active(user_id):
await notify(user_id)

Prefix coroutine-returning calls with await so the result is resolved before it is used.