# ValueError: 重复的路由路径：/items

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

## 根因

两个路由装饰器定义了相同的路径而没有区分方法。

## 版本兼容性

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

## 解决方案

1. **Use different HTTP methods for same path** (95% 成功率)
   ```
   @app.get('/items')
async def list_items(): pass
@app.post('/items')
async def create_item(): pass
   ```
2. **Use different paths** (90% 成功率)
   ```
   @app.get('/items')
async def list_items(): pass
@app.get('/items/{item_id}')
async def get_item(item_id: int): pass
   ```

## 无效尝试

- **Removing one route entirely** — May lose needed functionality. (50% 失败率)
- **Changing function name only** — Path remains duplicate. (70% 失败率)
