# werkzeug.exceptions.MethodNotAllowed: 405 Method Not Allowed: The method is not allowed for the requested URL.

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

## Root Cause

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

## Version Compatibility

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

## Workarounds

1. **** (96% success)
   ```
   @app.route('/x', methods=['POST'])\ndef x(): ...
   ```
2. **** (94% success)
   ```
   @app.get('/x')\n@app.post('/x')\ndef x(): ...
   ```

## Dead Ends

- **** — Does not enable POST; the 405 remains for POST requests. (80% fail)
- **** — Masks the real routing issue; clients still call the wrong method. (75% fail)
