Explanation
What just happened
save("a") without await only built a coroutine object. None of save’s code ran. Nothing kept the object, so Python threw it away at the end of the line and warned: coroutine 'save' was never awaited. The program carried on, and saved a never printed.
Try the what-if switch
- await it:
await save("a")runs it to the end, thensave("b")runs. No warning. - create_task:
save("a")becomes a task of its own and runs while main awaitssave("b"). Both writes wait at the same time.
Why
An async function is a recipe, not a call: calling it hands you the recipe. Something has to run it, either await here and now, or the event loop, once you make it a task.
How to fix it
Find the line the warning points at and add await. If you meant it to run in the background, use asyncio.create_task(...) and keep the task, so you can await it later.
Watch out
Because it’s only a warning, the bug can hide in logs: the work just never happens. It’s the async cousin of blocking the event loop with time.sleep.
Common questions
What does coroutine was never awaited mean?
You called an async function without await. That only creates a coroutine object and runs none of its code; when the unused object is thrown away, Python warns.
Does the missing await crash the program?
No. It's a warning, not an exception: the rest of the program runs and exits with code 0. Even with -W error, Python only reports it as "Exception ignored" and carries on.
Should I use await or asyncio.create_task?
await runs the coroutine to the end before moving on. asyncio.create_task runs it alongside the current code, starting at the next await; keep the task and await it before you rely on its result.
When exactly is the warning printed?
When the coroutine object is thrown away. For a call whose result nobody keeps, that is right after the line, not at the end of the program.
Verified: this timeline matches a real program, checked in CI on Python 3.14, 3.15 and free-threaded 3.15t. How we verify. Unclear or wrong? Tell us