# ValueError: Invalid value for path parameter 'id'. Expected int, got 'abc'

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

## Root Cause

在 Starlette 路由中定义了路径参数类型为 int，但客户端传入了非数字字符串。

## Version Compatibility

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

## Workarounds

1. **** (90% success)
   ```
   from starlette.routing import Route
async def get_item(request):
    id = request.path_params['id']
    try:
        id = int(id)
    except ValueError:
        return JSONResponse({'error': 'invalid'}, status_code=400)
   ```
2. **** (95% success)
   ```
   Route('/items/{id:int}', get_item)
   ```

## Dead Ends

- **** — 如果参数是 URL 路径的一部分，无法在客户端转换。 (60% fail)
- **** — 改变了 API 设计，可能影响其他依赖该参数类型的代码。 (50% fail)
