You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
reqwest streamable HTTP client drops JSON-RPC error bodies on HTTP 4xx into TransportSend #724
Describe the bug
A POST over Streamable HTTP that returns HTTP 4xx with Content-Type: application/json and a valid JSON-RPC error body is currently surfaced by the reqwest client as a transport error (UnexpectedServerResponse -> ServiceError::TransportSend) instead of a parsed JSON-RPC error (ServiceError::McpError).
cargo test -p rmcp --test test_streamable_http_http_error_jsonrpc --features "client server transport-streamable-http-client-reqwest transport-streamable-http-server"
Expected behavior
If response body is valid JSON-RPC and Content-Type is application/json, it should be parsed and surfaced as JSON-RPC message (so request callers receive ServiceError::McpError for error responses), even when HTTP status is 4xx.
This appears consistent with Streamable HTTP spec language that for non-accepted inputs, server may return HTTP error status and response body may be JSON-RPC error response:
Logs
Observed error shape from failing regression expectation before fix:
Err(UnexpectedServerResponse("HTTP 400 Bad Request: {\"jsonrpc\":\"2.0\",\"id\":1,\"error\":{\"code\":-32602,\"message\":\"Unknown prompt: example_prompt\"}}"))
Additional context
I have a proposed fix on branch fix-streamable-http-400-jsonrpc-error-mapping in my fork, but I am opening this issue first per docs/CONTRIBUTE.MD (“Discuss first”).
Activity
howardjohn commentedon Mar 4, 2026
Thanks @adam-r-kowalski !
cc @alexhancock from the original PR
DaleSeo commentedon Mar 7, 2026
Closing this as resolved.DaleSeo commentedon Mar 7, 2026
My bad, reopening.
kakarot-dev commentedon Mar 11, 2026
I have a fix for this, happy to open a PR
DaleSeo commentedon Mar 11, 2026
Hey @kakarot-dev, please go ahead and send a PR. We'd be happy to review :)
fix(rmcp): surface JSON-RPC error bodies on HTTP 4xx responses
fix(rmcp): surface JSON-RPC error bodies on HTTP 4xx responses
fix(rmcp): surface JSON-RPC error bodies on HTTP 4xx responses (#748)