Skip to content

Propagate body-level errors in WebClientStreamableHttpTransport#5774

Open
Planview-JamesK wants to merge 3 commits intospring-projects:mainfrom
Planview-JamesK:fix/889-body-error-propagation
Open

Propagate body-level errors in WebClientStreamableHttpTransport#5774
Planview-JamesK wants to merge 3 commits intospring-projects:mainfrom
Planview-JamesK:fix/889-body-error-propagation

Conversation

@Planview-JamesK
Copy link
Copy Markdown

@Planview-JamesK Planview-JamesK commented Apr 7, 2026

Summary

When WebClientStreamableHttpTransport.sendMessage() encounters a body-level error (e.g. DataBufferLimitException, malformed JSON), the onErrorComplete operator silently swallows the error. This leaves the pending McpClientSession response unresolved, causing a hang until requestTimeout (typically 300 seconds).

This PR changes onErrorComplete to onErrorResume so that body-level errors emit a synthetic JSON-RPC error response to the handler, resolving pending responses immediately.

This is a forward-port of the same fix applied to the MCP Java SDK:

Fixes #5775
Fixes modelcontextprotocol/java-sdk#889

Change onErrorComplete to onErrorResume in
WebClientStreamableHttpTransport.sendMessage() so that body-level
errors (DataBufferLimitException, parse errors, etc.) emit a synthetic
JSON-RPC error response to the handler. This resolves pending responses
in McpClientSession immediately instead of hanging until requestTimeout.

Fixes modelcontextprotocol/java-sdk#889

Signed-off-by: James Kennedy <james.kennedy@planview.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant