no-gather-first-exception-reraise
Raise every gathered failure instead of only the first.
Why
asyncio.gather(..., return_exceptions=True) waits for every operation and returns their failures as values. Scanning the results and raising the first exception discards every later failure, so concurrent cleanup or fan-out can lose the errors that explain what is still broken.
Fix
Use asyncio.TaskGroup when the first failure should cancel the siblings. When every operation must finish, as in cleanup, collect all failures and raise BaseExceptionGroup or ExceptionGroup so none is lost.
Examples
import asyncio
async def delete_all(paths: list[str]) -> None: results = await asyncio.gather( *(delete(path) for path in paths), return_exceptions=True ) for result in results: if isinstance(result, BaseException): raise resultimport asyncio
async def delete_all(paths: list[str]) -> None: results = await asyncio.gather( *(delete(path) for path in paths), return_exceptions=True ) failures = [result for result in results if isinstance(result, Exception)] if failures: raise ExceptionGroup("cleanup failed", failures)