# numpy.exceptions.AxisError: axis 2 is out of bounds for array of dimension 2

- **ID:** `python/numpy-axis-out-of-bounds`
- **Domain:** python
- **Category:** type_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Passing an axis argument larger than array.ndim - 1 to functions like np.sum, np.mean, np.concatenate. Often from assuming 3-D input.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.x | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   np.sum(arr, axis=-1)  # last axis regardless of ndim
   ```
2. **** (85% success)
   ```
   assert arr.ndim >= 3 or use np.sum(arr, axis=tuple(range(arr.ndim)))
   ```

## Dead Ends

- **** — Same AxisError (95% fail)
- **** — Changes semantics, not what you want (75% fail)
