Repository navigation
mcp: answer a request sent before initialize with Invalid Request - #1393
Merged
guglielmo-san merged 1 commit intoOct 12, 2026
Merged
guglielmo-san merged 1 commit into
guglielmo-san merged 1 commit into
Conversation
A legacy server session that has not been initialized refuses a request other than initialize or ping. The refusal was a plain error, which reaches the wire as JSON-RPC error code 0. It is now -32600 (Invalid Request). This is a behavioral change, so MCPGODEBUG=nopreinitinvalidrequest=1 restores the previous code. Fixes modelcontextprotocol#1367 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
guglielmo-san
approved these changes
Oct 12, 2026
Contributor
|
@talhayme thank you for the contribution! |
|
Confirmed downstream. Using the reproduction from #1367 (
We were rewriting the code to -32600 in a transport wrapper (Goldziher/ai-rulez#385) and will drop that for the authoring server once a release includes this. Thanks for the quick fix. |
Contributor
Author
|
Thanks for confirming. The other places where a plain error reaches the wire as code 0 (prompt, resource and raw tool handlers, middleware) are collected in #1394, in case your wrapper was covering those too. AI disclosure: drafted with Claude Code; I reviewed it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
A legacy server session that has not been initialized refuses a request other than initialize or ping. The refusal was a plain error, which reaches the wire as JSON-RPC error code 0. It is now -32600 (Invalid Request).
This is a behavioral change, so
MCPGODEBUG=nopreinitinvalidrequest=1restores the previous code. The option is documented indocs/mcpgodebug.mdunder 1.9.0, andTestServerHandle_LegacyCallBeforeInitializechecks both settings.Fixes #1367
AI disclosure: written with Claude Code; I reviewed the change and ran
go test ./...and the touched tests under-race.🤖 Generated with Claude Code