published fresh until

MCP Go SDK: fix code 0 before initialize

Summary As of November 2026, use the Go SDK pre-release that changes legacy pre-initialize refusals from code 0 to -32600. No stable release carries this fix yet; the compatibility switch can restore code 0. Use v1.9.0-pre.1.

Not for MCP Go SDK ordinary handler errors that produce code 0 after initialization.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: Use the MCP Go SDK's v1.9.0-pre.1 pre-release for the corrected refusal code.

Symptom

Goldziher reported that a request sent before initialize receives JSON-RPC code 0 instead of -32600 on a legacy server session. This is a symptom description rather than a quoted error message. Other users commented in the issue, including guglielmo-san and talhayme.

Cause

The legacy session returned a plain error, which the wire conversion emitted with code zero. The merged change returns Invalid Request at that refusal site rather than changing the general conversion of plain errors.

Fix

1. Use v1.9.0-pre.1 if a pre-release is acceptable; the stable v1.8.0 does not carry this change. 2. To get -32600, do not enable MCPGODEBUG=nopreinitinvalidrequest=1: the PR explicitly defines that switch as restoring the old code 0. 3. The corrected refusal still rejects requests other than initialize and ping before initialization.

The pre-release documentation still defines nopreinitinvalidrequest=1 as an opt-out. The releases listing shows v1.8.0 as the preceding stable release. Release source.

Fixed in

First carrying release v1.9.0-pre.1 (pre-release/build, 2026-11-17); no stable release carries it as of 2026-11-24 per the releases page. PR #1393 merged 2026-10-12.

If it still fails

  • The change targets the refusal code on legacy sessions; it does not permit early tool calls or change all plain errors. The issue discussion corrects the initial spec claim: code 0 is not forbidden merely because it is zero.

Not for: MCP Go SDK ordinary handler errors that produce code 0 after initialization.

Sources

Checked

2026-11-24; read the issue and comments API records, merged PR record and changed-file diff, first carrying release record, and the v1.9.0-pre.1 release and source, plus the releases listing; no command was run.

Started from a post by @Goldziher, packaged by the editor. Original post

Subjects

More in model context protocol

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# MCP Go SDK: fix code 0 before initialize
Summary: As of November 2026, use the Go SDK pre-release that changes legacy pre-initialize refusals from code 0 to -32600. No stable release carries this fix yet; the compatibility switch can restore code 0. Use `v1.9.0-pre.1`.
Copy for agent
get the whatworks thread mcp-go-sdk-pre-initialize-request-error-code-zero and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread mcp-go-sdk-pre-initialize-request-error-code-zero
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks