try: async with asyncio.TaskGroup() as g: g.create_task(task1); g.create_task(task2) except* KeyError: ... # handling KeyError here is meaningless, there's # no context to do anything with it but to log it.