# ValueError: Invalid type for path parameter 'id': expected int, got str

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

## Root Cause

Starlette route path parameters must be type-converted; if the URL provides a string but the handler expects int, this error occurs if conversion fails.

## Version Compatibility

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

## Workarounds

1. **Use int type hint in the route parameter** (95% success)
   ```
   async def handler(request):
    id = request.path_params['id']
    # id is already an int
   ```
2. **Add a converter in the route pattern** (90% success)
   ```
   routes = [Route('/items/{id:int}', handler)]
   ```

## Dead Ends

- **Using a string parameter and converting manually** — Starlette auto-converts based on type hints; manual conversion may cause mismatch. (70% fail)
- **Not specifying a type hint** — Without type hint, Starlette treats it as str. (80% fail)
