Title: Invalid method names return error code -32602 instead of -32601 · Issue #1561 · modelcontextprotocol/python-sdk · GitHub
Open Graph Title: Invalid method names return error code -32602 instead of -32601 · Issue #1561 · modelcontextprotocol/python-sdk
X Title: Invalid method names return error code -32602 instead of -32601 · Issue #1561 · modelcontextprotocol/python-sdk
Description: Initial Checks I confirm that I'm using the latest version of MCP Python SDK I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening this issue Description How to reproduce: echo...
Open Graph Description: Initial Checks I confirm that I'm using the latest version of MCP Python SDK I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening this ...
X Description: Initial Checks I confirm that I'm using the latest version of MCP Python SDK I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening t...
Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/issues/1561
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Invalid method names return error code -32602 instead of -32601","articleBody":"### Initial Checks\n\n- [x] I confirm that I'm using the latest version of MCP Python SDK\n- [x] I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening this issue\n\n### Description\n\n**How to reproduce:**\n```bash\necho '{\"jsonrpc\":\"2.0\",\"method\":\"invalid/method\",\"id\":1,\"params\":{}}' | your-mcp-server\n```\n\n**Expected result:**\n```json\n{\"jsonrpc\":\"2.0\",\"id\":1,\"error\":{\"code\":-32601,\"message\":\"Method not found\"}}\n```\n\n**Actual result:**\n```json\n{\"jsonrpc\":\"2.0\",\"id\":1,\"error\":{\"code\":-32602,\"message\":\"Invalid request parameters\",\"data\":\"\"}}\n```\n\nThe issue appears to occur because request validation in `mcp/shared/session.py` (lines 360-375) catches the validation exception and returns `-32602` before the proper method-not-found handler in `mcp/server/lowlevel/server.py` (lines 716-718) can be reached.\n\n### Example Code\n\n```Python\n\n```\n\n### Python \u0026 MCP Python SDK\n\n```Text\n**Environment:**\n- Python SDK version: `1.2.0`\n- Python version: `3.12`\n- Platform: macOS\n```","author":{"url":"https://github.com/corv89","@type":"Person","name":"corv89"},"datePublished":"2025-10-31T09:28:08.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/1561/python-sdk/issues/1561"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:3b7779c0-5d67-5ade-b889-8ee054876b21 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B628:13F5A7:14A6D92:1BC9EDF:6A5B8DD7 |
| html-safe-nonce | 8b834381e6b70ce1a8c51667bf997bece7400cd82f89390b44b4e0b9008b5b7a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNjI4OjEzRjVBNzoxNEE2RDkyOjFCQzlFREY6NkE1QjhERDciLCJ2aXNpdG9yX2lkIjoiMjAwNTk2ODUwNjA2MDUwODYzMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 8ac4b9eb8f21277aea78c5b2f862b679d60bd10fa4fa959f54883ba4abe3968d |
| hovercard-subject-tag | issue:3574098676 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/modelcontextprotocol/python-sdk/1561/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4fa82823ee048e117d8963a9cd68422a352fe2c234665347c703e812e0acf735/modelcontextprotocol/python-sdk/issues/1561 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4fa82823ee048e117d8963a9cd68422a352fe2c234665347c703e812e0acf735/modelcontextprotocol/python-sdk/issues/1561 |
| og:image:alt | Initial Checks I confirm that I'm using the latest version of MCP Python SDK I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening this ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | corv89 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5290d7e14309ad1e76106a9c4237bd1041517e83ea182c8ab756752cb0c6940b |
| turbo-cache-control | no-preview |
| go-import | github.com/modelcontextprotocol/python-sdk git https://github.com/modelcontextprotocol/python-sdk.git |
| octolytics-dimension-user_id | 182288589 |
| octolytics-dimension-user_login | modelcontextprotocol |
| octolytics-dimension-repository_id | 862584018 |
| octolytics-dimension-repository_nwo | modelcontextprotocol/python-sdk |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 862584018 |
| octolytics-dimension-repository_network_root_nwo | modelcontextprotocol/python-sdk |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9c975978430e9ad293956f2bbdaf153b1bd84a99 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width