# TypeError: ids must be a list of strings or None, got int

- **ID:** `python/pytest-parametrize-id-error`
- **Domain:** python
- **Category:** type_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The 'ids' parameter in @pytest.mark.parametrize is provided as a non-string iterable (e.g., list of integers) instead of strings.

## Version Compatibility

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

## Workarounds

1. **Convert ids to a list of strings using str() or a lambda.** (95% success)
   ```
   @pytest.mark.parametrize('arg', [1, 2], ids=[str(x) for x in [1, 2]])
   ```
2. **Use a lambda function to generate ids dynamically.** (90% success)
   ```
   @pytest.mark.parametrize('arg', [1, 2], ids=lambda x: f'case_{x}')
   ```

## Dead Ends

- **Using list comprehension to convert ids to strings but forgetting to pass them** — If the conversion is not applied to the ids parameter, the error persists. (60% fail)
- **Omitting the ids parameter entirely** — Tests will run without custom IDs, but the error is avoided; however, test reports may be less readable. (50% fail)
