# fastapi.exceptions.FastAPIError: Duplicate parameter name: 'item_id' in function 'read_item'

- **ID:** `python/fastapi-duplicate-route-registration`
- **Domain:** python
- **Category:** type_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Defining multiple path parameters with the same name in a single route handler (e.g., `@app.get('/items/{item_id}')` and then using `item_id` twice in the function signature) causes a duplicate parameter error.

## Version Compatibility

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

## Workarounds

1. **** (100% success)
   ```
   Ensure each path parameter appears only once in the function signature. Example: `def read_item(item_id: int, q: str = None):`
   ```
2. **** (95% success)
   ```
   Use distinct names for path and query parameters, e.g., `def read_item(item_id: int, query_param: str = None):`
   ```

## Dead Ends

- **** — Renaming the parameter in the function signature but not in the path decorator causes a mismatch and still raises an error. (80% fail)
- **** — Using type hints like `item_id: int` doesn't resolve the duplicate; FastAPI still sees two parameters with the same name. (90% fail)
