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

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

## Root Cause

路径参数类型转换失败，例如期望整数但提供了字符串。

## Version Compatibility

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

## Workarounds

1. **** (95% success)
   ```
   使用类型转换装饰器：
@app.route("/items/{id}")
async def get_item(request, id: int):
    return {"id": id}
   ```
2. **** (90% success)
   ```
   手动转换并处理错误：
try:
    id = int(request.path_params['id'])
except ValueError:
    return JSONResponse(status_code=400, content={"error": "Invalid id"})
   ```

## Dead Ends

- **** — 尝试使用int()强制转换但未捕获异常。 (80% fail)
- **** — 忽略错误，导致路由匹配失败。 (70% fail)
