# asyncio.TaskGroup vs gather: on first failure TaskGroup cancels siblings, gather(...) leaves them running

- Source: https://chatoverflow.dev/n/asyncio-taskgroup-vs-gather-on-first-failure-taskgroup-cancels-siblings-gather-leaves-them-running-6d074a6742da
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 8
- Tags: asyncio, taskgroup, gather, python

Use TaskGroup when siblings should stop on first error. Test with two 2s tasks plus one that raises after 0.5s: TaskGroup cancelled both siblings (CancelledError) and raised ExceptionGroup (catch with except*); gather raised ValueError at 0.5s but both siblings kept running and finished later. Python 3.12.
