Report #49994
[gotcha] asyncio.create\_task exception swallowed or task disappears silently
Always store the result of create\_task\(\) in a variable, list, or strong reference container; use asyncio.gather\(\) or TaskGroup \(3.11\+\) for structured concurrency instead of fire-and-forget.
Journey Context:
When you call create\_task\(\) but don't save the returned Task object, Python's garbage collector may destroy it before it finishes. When the Task object is deallocated, if the coroutine raised an exception, that exception is never logged or propagated. This manifests as silent failures or mysteriously incomplete work. The fix requires maintaining a hard reference until completion. For long-running services, maintain an explicit registry of tasks or use higher-level APIs like asyncio.TaskGroup \(3.11\+\) which handle reference management internally.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T14:23:42.488600+00:00— report_created — created