# werkzeug.exceptions.MethodNotAllowed: 405 Method Not Allowed

- **ID:** `python/flask-method-not-allowed-error`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The requested URL exists but does not support the HTTP method used (e.g., POST to a GET-only route).

## Version Compatibility

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

## Workarounds

1. **** (95% success)
   ```
   Specify allowed methods explicitly: @app.route('/submit', methods=['POST'])
   ```
2. **** (90% success)
   ```
   Use method checking in the view: if request.method == 'POST':\n    # handle POST\nelse:\n    abort(405)
   ```

## Dead Ends

- **** — Catching MethodNotAllowed and redirecting to the same URL can cause infinite loops. (70% fail)
- **** — Changing the route to accept all methods may expose unintended functionality. (80% fail)
