# ValueError: Duplicate path operation: GET /items/{item_id}

- **ID:** `python/fastapi-path-operation-conflict`
- **Domain:** python
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

FastAPI中定义了多个相同HTTP方法和路径的路由。

## Version Compatibility

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

## Workarounds

1. **确保每个路径和方法组合唯一** (95% success)
   ```
   @app.get('/items/{item_id}') async def read_item(item_id: int): return {'item_id': item_id}; @app.post('/items/{item_id}') async def update_item(item_id: int): return {'updated': item_id}
   ```
2. **使用不同的路径或添加版本前缀** (90% success)
   ```
   @app.get('/v1/items/{item_id}') async def read_item_v1(item_id: int): return {'item_id': item_id}
   ```

## Dead Ends

- **尝试覆盖路由而不删除旧路由** — FastAPI不允许重复注册。 (90% fail)
- **使用不同的函数名但相同的路径和方法** — 路径和方法是唯一标识。 (80% fail)
