# ValueError: xlim must be a 2-element sequence of numbers, got [0, 10, 20]

- **ID:** `python/matplotlib-axes-limits-error`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Passing a list with more than two elements to set_xlim() or xlim parameter.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.8 | active | — | — |
| 3.9 | active | — | — |

## Workarounds

1. **Use a two-element sequence** (95% success)
   ```
   ax.set_xlim([0, 10])  # or (0, 10)
   ```
2. **Set min and max separately** (90% success)
   ```
   ax.set_xlim(left=0, right=10)
   ```

## Dead Ends

- **Passing a tuple of three numbers** — A tuple with three elements also fails; only two-element sequences are allowed. (90% fail)
- **Using xlim=(0,10,20) as keyword argument** — Same issue; xlim expects exactly two values. (85% fail)
