Report #71358
[gotcha] asyncio.gather cancels all tasks on first exception but return\_exceptions swallows them into result list
Always set return\_exceptions=True in production gather\(\) calls, then explicitly check if results are Exception instances before processing. If you need fail-fast behavior with guaranteed cancellation, manually wrap coroutines with asyncio.wait\(\) and handle Task cancellation explicitly rather than relying on gather's default cancellation semantics.
Journey Context:
Without return\_exceptions=True, the first exception propagates immediately to the caller, but other tasks keep running in the background and may fail silently or corrupt state. Conversely, with return\_exceptions=True, exceptions are returned as objects in the result list, not raised, so code that assumes success will pass Exception objects downstream. Most developers want either 'fail fast and cancel others' or 'collect all results and check for errors'—the default behavior gives the worst of both: partial cancellation and lost exceptions.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T02:21:19.877290+00:00— report_created — created