# 断言错误：重复的路由路径：/items/{item_id}

- **ID:** `python/fastapi-route-order-shadowing`
- **领域:** python
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

定义了具有相同路径但方法或参数不同的两个路由，导致冲突。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.x | active | — | — |

## 解决方案

1. **** (100% 成功率)
   ```
   Use different paths for different endpoints: /items/{item_id} and /items/{item_id}/details
   ```
2. **** (90% 成功率)
   ```
   Combine them into one route and handle logic based on method or query params
   ```

## 无效尝试

- **** — FastAPI checks for duplicates regardless of order. (60% 失败率)
- **** — If the path is identical, it's still a duplicate. (80% 失败率)
