Handler-generated invalid params errors use HTTP 400 on the modern Streamable HTTP path
维护者通常 3 天内回复
评估
这个 Issue 还没有评估数据。
描述
Describe the bug
On the modern (2026-07-28) Streamable HTTP path, jsonrpc_http_status maps every ErrorCode::INVALID_PARAMS (-32602) response to HTTP 400. This includes ordinary application errors that the spec defines as -32602 and that are not transport validation failures:
resources/readfor a resource that does not exist (resources: Error Handling)prompts/getwith an unknown prompt name or a missing required argument (prompts: Error Handling)tools/callfor an unknown tool (tools: Error Handling)
The 2026-07-28 Streamable HTTP spec requires HTTP 400 only for HeaderMismatch, UnsupportedProtocolVersionError, and MissingRequiredClientCapabilityError, and HTTP 404 for -32601. Its backward-compatibility rules tell a client that receives HTTP 400 to inspect the body and fall back to initialize when it is not one of those recognized modern errors. A spec-compliant client could therefore treat a 400 carrying a "resource not found" -32602 as a legacy server and downgrade.
To Reproduce
- Implement a
ServerHandlerwhoseread_resourcereturnsErr(ErrorData::resource_not_found(...))(orErrorData::invalid_params(...)fromget_prompt/call_tool). - Send a valid modern Streamable HTTP request with protocol version
2026-07-28that reaches the handler. - Observe HTTP 400 with a JSON-RPC body containing error code
-32602.
Expected behavior
Handler-generated -32602 errors should be sent with HTTP 200 as in-band JSON-RPC errors, like other handler errors that jsonrpc_http_status does not map.
Logs
actual: HTTP 400, JSON-RPC error -32602 "Resource not found for URI: ui://widget/nope"
expected: HTTP 200, JSON-RPC error -32602
Found with rmcp 3.5.0 by MCPJam's modern-resource-not-found-invalid-params check (@mcpjam/sdk 8.20.1, profile [email protected]), which expects an in-band error. The official conformance suite (0.2.0-alpha.11) does not check the status code for this case.
Additional context
The mapping is in jsonrpc_http_status:
Transport-generated malformed-request errors, such as a missing protocolVersion in _meta, already build their HTTP 400 response directly in invalid_params_jsonrpc_response, so removing INVALID_PARAMS from this mapper should not change those responses.
#1303 is related. It makes malformed params for spec methods return -32602 instead of -32601, which fixes the 404, but with the current mapper those responses become HTTP 400.
- 主要语言
- Rust
- 星标
- 4k
- 派生
- 654
- 平均合并
- 4 天 2 小时
- 30 天内合并 PR
- 40
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
modelcontextprotocol/rust-sdk 的其他 Issue
-
P3 question T-documentation T-enhancement
难度 1/5 1 小时以内 新手友好度 86/100
modelcontextprotocol/rust-sdk#1155 ·
维护者通常 3 天内回复
-
bug P1 ready for work T-transport
难度 4/5 3-5 天 新手友好度 55/100
modelcontextprotocol/rust-sdk#1325 ·
维护者通常 3 天内回复
-
streamable-http server: client responses to server-initiated requests (sampling/elicitation/roots) are 202-accepted and silently discarded under the 2026-07-28 protocol — the pending request hangs forever可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭bug P1 ready for work T-transport
难度 5/5 一周以上 新手友好度 35/100
modelcontextprotocol/rust-sdk#1321 ·
维护者通常 3 天内回复
-
Bound pre-lifecycle bootstrap attempts in server initialization可能已有人在做 @DaleSeo 于 4 天前认领。 未关闭enhancement P2 T-service T-transport
modelcontextprotocol/rust-sdk#1315 · 已指派 1 人 ·
维护者通常 3 天内回复
-
bug P1 ready for work T-handler
难度 4/5 3-5 天 新手友好度 25/100
modelcontextprotocol/rust-sdk#1312 ·
维护者通常 3 天内回复
查看 modelcontextprotocol/rust-sdk 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 5 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
tauri-apps/tauri#16219 ·
维护者通常 2 天内回复
-
state:triage-needed
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
ktuner keeps a stale ledger path and can never restore that entry可能已有人在做 @Frun1na 今天认领。 未关闭component:ktuner
难度 2/5 1-3 小时 新手友好度 75/100
agentic-os-org/ANOLISA#6483 · 1 条评论 ·
维护者通常 1 天内回复