# HTTPException: 405 Method Not Allowed

- **ID:** `python/starlette-http-405-method-not-allowed`
- **Domain:** python
- **Category:** network_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The HTTP method used is not allowed for the requested endpoint.

## Version Compatibility

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

## Workarounds

1. **Check the allowed methods for the endpoint and use the correct one.** (95% success)
   ```
   Check route: @app.route('/items', methods=['GET'])
   ```
2. **Add the missing method to the route decorator.** (90% success)
   ```
   @app.route('/items', methods=['GET', 'POST'])
   ```

## Dead Ends

- **Assuming all methods are allowed by default.** — Routes are defined with specific methods; others are rejected. (80% fail)
- **Using POST instead of GET without checking the endpoint definition.** — The endpoint may only accept GET requests. (70% fail)
