Report #13151
[gotcha] asyncio.gather cancels remaining tasks immediately when one raises
Set return\_exceptions=True in gather\(\) to prevent cancellation of other tasks when one fails, allowing all tasks to complete or fail independently and preserving partial results for inspection.
Journey Context:
Without return\_exceptions=True, gather\(\) eagerly cancels all pending futures as soon as one raises an exception, which destroys partial results and prevents cleanup in other tasks. This is often surprising because 'gather' implies waiting for everything, but the default optimizes for fast-fail. Setting return\_exceptions=True changes the semantics to 'run all and report status', which is usually what you want for independent tasks. Note that this wraps exceptions in the result list rather than raising immediately, so you must check isinstance\(result, Exception\).
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T17:51:54.676727+00:00— report_created — created