Report #79912
[gotcha] Asyncio task exception is silently lost or only logged to stderr instead of propagating
Always await every Task, register a done callback that calls \`task.exception\(\)\`, or use \`asyncio.gather\(\*tasks, return\_exceptions=True\)\` to ensure exceptions are retrieved. Never fire-and-forget a Task without an error handler.
Journey Context:
When an asyncio Task raises an exception, the exception is stored in the Task object. If nothing ever retrieves it \(via \`await\`, \`task.result\(\)\`, or \`task.exception\(\)\`\), the event loop logs an error on GC \(Python 3.8\+\) or silently drops it \(earlier versions\). This creates heisenbugs where code fails but the program continues running in a corrupted state. The fix requires explicit exception retrieval patterns: either structured concurrency \(gather\) or explicit error callbacks. This ensures fail-fast behavior and prevents silent data corruption.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T16:43:53.263714+00:00— report_created — created