# TypeError: 'str' object cannot be interpreted as an integer

- **ID:** `python/starlette-route-parameter-type-mismatch`
- **Domain:** python
- **Category:** type_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

A route parameter expected as an integer is passed as a string without conversion.

## Version Compatibility

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

## Workarounds

1. **Convert the parameter to int explicitly** (90% success)
   ```
   async def get_item(item_id: str):
    item_id = int(item_id)
   ```
2. **Use Starlette's path converter for int** (95% success)
   ```
   @app.route('/items/{item_id:int}')
async def get_item(item_id: int):
    ...
   ```

## Dead Ends

- **Using str() on the parameter** — Doesn't convert to int; keeps it as string. (80% fail)
- **Ignoring the type and using the string directly** — May cause errors in logic expecting an integer. (70% fail)
