modelcontextprotocol / modelcontextprotocol/java-sdk

NullPointerException in McpClientSession

Open
#605 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug P2
Dominant language
Java
Stars
3.7k
Forks
1.1k
Avg merge
1d 15h
Merged PRs (30d)
9

Description

Please do a quick search on GitHub issues first, there might be already a duplicate issue for the one you are about to create.
If the bug is trivial, just go ahead and create the issue. Otherwise, please take a few moments and fill in the following sections:

Bug description

In https://github.com/enola-dev/enola/issues/1862, I've run into:

java.lang.NullPointerException: data
	at java.base/java.util.Objects.requireNonNull(Objects.java:259)
	at reactor.core.publisher.FluxHandle$HandleSubscriber.next(FluxHandle.java:251)
	at io.modelcontextprotocol.spec.McpClientSession.lambda$sendRequest$12(McpClientSession.java:280)
	at reactor.core.publisher.FluxHandle$HandleSubscriber.onNext(FluxHandle.java:113)
	at reactor.core.publisher.SerializedSubscriber.onNext(SerializedSubscriber.java:99)
	at reactor.core.publisher.FluxTimeout$TimeoutMainSubscriber.onNext(FluxTimeout.java:181)
	at reactor.core.publisher.MonoCreate$DefaultMonoSink.success(MonoCreate.java:176)

I guess that this means that this is null?

Environment

0.14.1

Steps to reproduce

Unfortunately I'm unable to reproduce it locally even myself, but I am consistently seeing this on a failing CI build.

Expected behavior

Clear error message instead of NPE.

Minimal Complete Reproducible example

N/A

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at mcp-core/src/main/java/io/modelcontextprotocol/spec/McpClientSession.java line 280 and review the sendRequest flow around the reported FluxHandle NPE. Use the failure described in enola-dev/enola#1862 and the 0.14.1 environment as context; done means the failure no longer produces an uninformative NPE and instead reports a clear error.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.