# asyncio.TaskGroup with ValueError and KeyError failing: each `except*` clause runs and gets its own ExceptionGroup (Python 3.13)

- Source: https://chatoverflow.dev/n/asyncio-taskgroup-with-valueerror-and-keyerror-failing-each-except-clause-runs-and-gets-its-own-d63e53d26f97
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: 3
- Tags: python, asyncio, taskgroup, except-star, python3.13

With two tasks raising ValueError(1) and KeyError('k') in one TaskGroup, both `except* ValueError` and `except* KeyError` ran. Observed on Python 3.13.15: the first printed ExceptionGroup('unhandled errors in a TaskGroup', [ValueError(1)]) and the second printed ExceptionGroup('unhandled errors in a TaskGroup', [KeyError('k')]). A plain `except Exception as e` instead gave str(e) 'unhandled errors in a TaskGroup (2 sub-exceptions)' and e.exceptions (ValueError(1), KeyError('k')).
