GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Propagate body-level errors as synthetic JSON-RPC responses by Planview-JamesK · Pull Request #896 · modelcontextprotocol/java-sdk

Conversation

@Planview-JamesK

@Planview-JamesK Planview-JamesK commented Apr 2, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Motivation and Context

Fixes #889. When body-level errors occur during response streaming in sendMessage() (e.g. DataBufferLimitException, JSON parse errors, ReadTimeoutException), the onErrorComplete operator silently drops them. Because sink.success() has already been called when the HTTP response headers arrive, the error has no path to reach the caller. The pending response in McpClientSession.pendingResponses hangs until requestTimeout.

Summary

  • Change onErrorComplete to onErrorResume in HttpClientStreamableHttpTransport.sendMessage()
  • When a body-level error occurs and the message has a request ID, emit a synthetic JSONRPCResponse with INTERNAL_ERROR to the handler so McpClientSession.pendingResponses gets resolved immediately
  • Notifications (no request ID) do not emit synthetic responses

How Has This Been Tested?

Three new tests in HttpClientStreamableHttpTransportBodyErrorTest:

  • SSE parse error — server returns SSE with malformed JSON, error propagates
  • JSON parse error — server returns malformed application/json, synthetic error response emitted to handler with matching request ID
  • Notification — no synthetic response emitted for messages without a request ID

All existing error handling tests continue to pass.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
This was referenced Apr 2, 2026
WebClientStreamableHttpTransport: SSE body errors silently dropped, callTool hangs until timeout #889
Closed
Backport: Propagate body-level errors as synthetic JSON-RPC responses #897
Open
@Planview-JamesK
Propagate body-level errors as synthetic JSON-RPC responses
d727c30
Change onErrorComplete to onErrorResume in 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#889
@Planview-JamesK
Planview-JamesK force-pushed the fix/889-body-error-propagation-main branch from d44a783 to d727c30 Compare April 7, 2026 23:38
This was referenced Apr 7, 2026
Propagate body-level errors in WebClientStreamableHttpTransport spring-projects/spring-ai#5774
Open
WebClientStreamableHttpTransport silently drops body-level errors spring-projects/spring-ai#5775
Open
@chemicL chemicL mentioned this pull request Sep 29, 2026
Refactor HttpClient-based transports to Publisher-based approach #1079
Merged
@hpdkhoa hpdkhoa mentioned this pull request Oct 2, 2026
Stdio client stops processing responses after rejecting a malformed response #1157
Open

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

WebClientStreamableHttpTransport: SSE body errors silently dropped, callTool hangs until timeout

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@Planview-JamesK
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.