[BUG] Claude Code intermittently produces malformed JSON when reading parallel stdio MCP responses
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Summary
When Claude Code issues parallel tools/call requests to a stdio MCP server, it
intermittently fails to parse a server response, reporting a malformed/merged JSON.
The failure is non-deterministic (a timing race), so it does not reproduce on every
parallel call, but it does not occur under serial calls.
Evidence shows the bytes on the stdio wire are always clean, well-formed, newline-delimited
JSON-RPC frames — one frame per line, with correct id correlation. The malformation is
therefore introduced inside Claude Code's own stdio reader, after the bytes leave the
pipe, most likely a framing/buffering race that occasionally feeds two frames (or a partial
frame + the next frame) into a single JSON.parse.
What Should Happen?
Expected behavior
Claude Code's stdio MCP reader should split the server's stdout strictly on \n andJSON.parse each line independently, under any concurrency of in-flight requests. It must
never concatenate two frames or feed a partial frame into a parse. Given that the wire is
always clean NDJSON (proven by Repro A), the client should never report malformed JSON for
this server.
Error Messages/Logs
2026-06-21T15:17:28.514Z [DEBUG] MDM settings load completed in 60ms
2026-06-21T15:17:28.553Z [DEBUG] Broken symlink or missing file encountered for settings.json at path: C:\Program Files\ClaudeCode\managed-settings.json
2026-06-21T15:17:28.554Z [DEBUG] Broken symlink or missing file encountered for settings.json at path: D:\Games\RpgMaker\.mcp-repro\.claude\settings.json
2026-06-21T15:17:28.555Z [DEBUG] Broken symlink or missing file encountered for settings.json at path: D:\Games\RpgMaker\.mcp-repro\.claude\settings.local.json
2026-06-21T15:17:28.555Z [DEBUG] CA certs: Config fallback - globalEnv keys: , settingsEnv keys: ANTHROPIC_AUTH_TOKEN,ANTHROPIC_BASE_URL,ANTHROPIC_DEFAULT_FABLE_MODEL,ANTHROPIC_DEFAULT_FABLE_MODEL_NAME,ANTHROPIC_DEFAULT_HAIKU_MODEL,ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME,ANTHROPIC_DEFAULT_OPUS_MODEL,ANTHROPIC_DEFAULT_OPUS_MODEL_NAME,ANTHROPIC_DEFAULT_SONNET_MODEL,ANTHROPIC_DEFAULT_SONNET_MODEL_NAME,CLAUDE_CODE_EFFORT_LEVEL,ENABLE_TOOL_SEARCH
2026-06-21T15:17:28.562Z [DEBUG] [init] configureGlobalMTLS starting
2026-06-21T15:17:28.563Z [DEBUG] [init] configureGlobalMTLS complete
2026-06-21T15:17:28.563Z [DEBUG] [init] configureGlobalAgents starting
2026-06-21T15:17:28.563Z [DEBUG] CA certs: stores=bundled,system, extraCertsPath=undefined
2026-06-21T15:17:28.564Z [DEBUG] CA certs: Loaded 145 bundled root certificates
2026-06-21T15:17:28.614Z [DEBUG] CA certs: Loaded 496 system CA certificates
2026-06-21T15:17:28.614Z [DEBUG] mTLS: Creating HTTPS agent with custom certificates
2026-06-21T15:17:28.615Z [DEBUG] [init] configureGlobalAgents complete
2026-06-21T15:17:28.617Z [DEBUG] Using bash path: "C:\Program Files\Git\bin\bash.exe"
2026-06-21T15:17:28.620Z [DEBUG] Error log sink initialized
2026-06-21T15:17:28.630Z [DEBUG] [ToolSearch:optimistic] mode=tst, ENABLE_TOOL_SEARCH=true, result=true
2026-06-21T15:17:28.644Z [DEBUG] [claudeai-mcp] Disabled: API-key auth precedence active
2026-06-21T15:17:28.644Z [DEBUG] [STARTUP] Loading MCP configs...
2026-06-21T15:17:28.654Z [DEBUG] Loaded 5 installed plugins from C:\Users\Administrator\.claude\plugins\installed_plugins.json
2026-06-21T15:17:28.656Z [DEBUG] Found 0 plugins (0 enabled, 0 disabled)
2026-06-21T15:17:28.657Z [DEBUG] [STARTUP] Running setup()...
2026-06-21T15:17:28.661Z [DEBUG] Loading skills from: managed=C:\Program Files\ClaudeCode\.claude\skills, user=C:\Users\Administrator\.claude\skills, project=[]
2026-06-21T15:17:28.663Z [DEBUG] Broken symlink or missing file encountered for settings.json at path: C:\Program Files\ClaudeCode\managed-settings.json
2026-06-21T15:17:28.665Z [DEBUG] Broken symlink or missing file encountered for settings.json at path: D:\Games\RpgMaker\.mcp-repro\.claude\settings.json
2026-06-21T15:17:28.666Z [DEBUG] Broken symlink or missing file encountered for settings.json at path: D:\Games\RpgMaker\.mcp-repro\.claude\settings.local.json
2026-06-21T15:17:28.666Z [DEBUG] Error log sink initialized
2026-06-21T15:17:28.667Z [DEBUG] getPluginSkills: Processing 0 enabled plugins
2026-06-21T15:17:28.667Z [DEBUG] Total plugin workflows loaded: 0
2026-06-21T15:17:28.668Z [DEBUG] Total plugin commands loaded: 0
2026-06-21T15:17:28.669Z [DEBUG] Registered 0 hooks from 0 plugins
2026-06-21T15:17:28.670Z [DEBUG] Failed to stat directory C:\Program Files\ClaudeCode\.claude\commands: ENOENT: no such file or directory, stat 'C:\Program Files\ClaudeCode\.claude\commands'
2026-06-21T15:17:28.671Z [DEBUG] Failed to stat directory C:\Users\Administrator\.claude\commands: ENOENT: no such file or directory, stat 'C:\Users\Administrator\.claude\commands'
2026-06-21T15:17:28.671Z [DEBUG] Loaded 0 unique skills (0 unconditional, 0 conditional, managed: 0, user: 0, project: 0, additional: 0, legacy commands: 0)
2026-06-21T15:17:28.679Z [DEBUG] [STARTUP] setup() completed in 21ms
2026-06-21T15:17:28.680Z [DEBUG] Cleared CA certificates cache
2026-06-21T15:17:28.680Z [DEBUG] Cleared mTLS configuration cache
2026-06-21T15:17:28.681Z [DEBUG] Cleared proxy agent cache
2026-06-21T15:17:28.681Z [DEBUG] CA certs: stores=bundled,system, extraCertsPath=undefined
2026-06-21T15:17:28.681Z [DEBUG] CA certs: Loaded 145 bundled root certificates
2026-06-21T15:17:28.681Z [DEBUG] CA certs: Loaded 496 system CA certificates
2026-06-21T15:17:28.682Z [DEBUG] mTLS: Creating HTTPS agent with custom certificates
2026-06-21T15:17:28.699Z [DEBUG] [STARTUP] Loading commands and agents...
2026-06-21T15:17:28.702Z [DEBUG] Total plugin skills loaded: 0 (0 duplicate/user-owned entries skipped)
2026-06-21T15:17:28.703Z [DEBUG] getSkills returning: 0 skill dir commands, 0 plugin skills, 20 bundled skills, 0 builtin plugin skills
2026-06-21T15:17:28.708Z [DEBUG] Failed to stat directory C:\Program Files\ClaudeCode\.claude\agents: ENOENT: no such file or directory, stat 'C:\Program Files\ClaudeCode\.claude\agents'
2026-06-21T15:17:28.708Z [DEBUG] Failed to stat directory C:\Users\Administrator\.claude\agents: ENOENT: no such file or directory, stat 'C:\Users\Administrator\.claude\agents'
2026-06-21T15:17:28.709Z [DEBUG] Total plugin agents loaded: 0
2026-06-21T15:17:28.711Z [DEBUG] [STARTUP] Commands and agents loaded in 11ms
2026-06-21T15:17:28.711Z [DEBUG] [LSP MANAGER] initializeLspServerManager() called
2026-06-21T15:17:28.712Z [DEBUG] [LSP MANAGER] Created manager instance, state=pending
2026-06-21T15:17:28.712Z [DEBUG] [LSP MANAGER] Starting async initialization (generation 1)
2026-06-21T15:17:28.712Z [DEBUG] Starting background startup prefetches
2026-06-21T15:17:28.712Z [DEBUG] [Bootstrap] Skipped: no usable OAuth, WIF, or API key
2026-06-21T15:17:28.713Z [DEBUG] [STARTUP] MCP configs resolved in 13ms (awaited at +69ms)
2026-06-21T15:17:28.716Z [DEBUG] All plugins already exist, skipping migration
2026-06-21T15:17:28.717Z [DEBUG] Cleared CA certificates cache
2026-06-21T15:17:28.718Z [DEBUG] Cleared mTLS configuration cache
2026-06-21T15:17:28.718Z [DEBUG] Cleared proxy agent cache
2026-06-21T15:17:28.718Z [DEBUG] CA certs: stores=bundled,system, extraCertsPath=undefined
2026-06-21T15:17:28.719Z [DEBUG] CA certs: Loaded 145 bundled root certificates
2026-06-21T15:17:28.719Z [DEBUG] CA certs: Loaded 496 system CA certificates
2026-06-21T15:17:28.719Z [DEBUG] mTLS: Creating HTTPS agent with custom certificates
2026-06-21T15:17:28.720Z [DEBUG] Total LSP servers loaded: 0
2026-06-21T15:17:28.721Z [DEBUG] Initialized versioned plugins system with 5 plugins
2026-06-21T15:17:28.725Z [DEBUG] Fast mode unavailable: Fast mode is not available in the Agent SDK
2026-06-21T15:17:28.726Z [DEBUG] [MCP] --mcp-config servers running fully async (nonblocking)
2026-06-21T15:17:28.726Z [DEBUG] [MCP] claude.ai connectors running fully async (nonblocking)
2026-06-21T15:17:28.726Z [DEBUG] [LSP SERVER MANAGER] getAllLspServers returned 0 server(s)
2026-06-21T15:17:28.727Z [DEBUG] LSP manager initialized with 0 servers
2026-06-21T15:17:28.731Z [DEBUG] MCP server "rpgmaker-mv": Starting connection with timeout of 30000ms
2026-06-21T15:17:28.754Z [DEBUG] [Perfetto] initializePerfettoTracing called, env value: undefined
2026-06-21T15:17:28.754Z [DEBUG] [3P telemetry] isTelemetryEnabled=false (CLAUDE_CODE_ENABLE_TELEMETRY=undefined)
2026-06-21T15:17:28.762Z [DEBUG] LSP server manager initialized successfully
2026-06-21T15:17:28.762Z [DEBUG] LSP notification handlers registered successfully for all 0 server(s)
2026-06-21T15:17:28.772Z [DEBUG] [auto-mode] verifyAutoModeGateAccess: enabledState=opt-in disabledBySettings=false model=claude-haiku-4-5 modelSupported=false disableFastModeBreakerFires=false carouselAvailable=false canEnterAuto=false
2026-06-21T15:17:28.772Z [WARN] auto mode disabled: model claude-haiku-4-5 does not support auto mode
2026-06-21T15:17:28.773Z [DEBUG] [auto-mode] kickOutOfAutoIfNeeded applying: ctx.mode=default ctx.prePlanMode=undefined reason=model
2026-06-21T15:17:28.807Z [DEBUG] [ScheduledTasks] scheduler start() — enabled=false, hasTasks=false
2026-06-21T15:17:28.816Z [DEBUG] Tool search disabled: ToolSearchTool is not available (may have been disallowed via disallowedTools).
2026-06-21T15:17:28.822Z [DEBUG] attribution header x-anthropic-billing-header: cc_version=2.1.185.a70; cc_entrypoint=sdk-cli;
2026-06-21T15:17:28.823Z [DEBUG] Fast mode unavailable: Fast mode is not available in the Agent SDK
2026-06-21T15:17:28.824Z [DEBUG] Fast mode unavailable: Fast mode is not available in the Agent SDK
2026-06-21T15:17:28.826Z [DEBUG] [API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: false, has Authorization header: false
2026-06-21T15:17:28.827Z [DEBUG] [API:auth] OAuth token check starting
2026-06-21T15:17:28.835Z [DEBUG] Failed to stat directory C:\Program Files\ClaudeCode\.claude\skills: ENOENT: no such file or directory, stat 'C:\Program Files\ClaudeCode\.claude\skills'
2026-06-21T15:17:28.835Z [DEBUG] Failed to stat directory C:\Users\Administrator\.claude\skills: ENOENT: no such file or directory, stat 'C:\Users\Administrator\.claude\skills'
2026-06-21T15:17:28.837Z [DEBUG] installPluginsForHeadless: starting
2026-06-21T15:17:28.837Z [DEBUG] Failed to stat directory C:\Users\Administrator\.claude\output-styles: ENOENT: no such file or directory, stat 'C:\Users\Administrator\.claude\output-styles'
2026-06-21T15:17:28.838Z [DEBUG] Failed to stat directory C:\Program Files\ClaudeCode\.claude\output-styles: ENOENT: no such file or directory, stat 'C:\Program Files\ClaudeCode\.claude\output-styles'
2026-06-21T15:17:28.838Z [DEBUG] Total plugin output styles loaded: 0
2026-06-21T15:17:28.839Z [DEBUG] act_dont_rederive_arm_active source=growthbook
2026-06-21T15:17:28.973Z [DEBUG] [API:auth] OAuth token check complete
2026-06-21T15:17:28.975Z [DEBUG] Fast mode unavailable: Fast mode is not available in the Agent SDK
2026-06-21T15:17:28.976Z [DEBUG] [API:timing] dispatching to firstParty model=claude-haiku-4-5
2026-06-21T15:17:28.979Z [DEBUG] [API REQUEST] /v1/messages source=generate_session_title
2026-06-21T15:17:29.004Z [DEBUG] Watching for changes in setting files C:\Users\Administrator\.claude\settings.json...
2026-06-21T15:17:29.051Z [DEBUG] Git remote URL: null
2026-06-21T15:17:29.052Z [DEBUG] No git remote URL found
2026-06-21T15:17:29.079Z [DEBUG] LSP Diagnostics: getLSPDiagnosticAttachments called
2026-06-21T15:17:29.079Z [DEBUG] LSP Diagnostics: Checking registry - 0 pending
2026-06-21T15:17:29.080Z [DEBUG] Hooks: Found 0 total hooks in registry
2026-06-21T15:17:29.080Z [DEBUG] Sending 13 skills via attachment (initial)
2026-06-21T15:17:29.082Z [DEBUG] Hooks: checkForNewResponses returning 0 responses
2026-06-21T15:17:29.083Z [WARN] [3P telemetry] Event dropped (no event logger initialized): user_prompt
2026-06-21T15:17:29.089Z [DEBUG] Fast mode unavailable: Fast mode is not available in the Agent SDK
2026-06-21T15:17:29.106Z [DEBUG] Dynamic tool loading: 0/18 deferred tools included
2026-06-21T15:17:29.107Z [DEBUG] attribution header x-anthropic-billing-header: cc_version=2.1.185.781; cc_entrypoint=sdk-cli;
2026-06-21T15:17:29.108Z [DEBUG] Fast mode unavailable: Fast mode is not available in the Agent SDK
2026-06-21T15:17:29.108Z [DEBUG] Fast mode unavailable: Fast mode is not available in the Agent SDK
2026-06-21T15:17:29.109Z [DEBUG] [API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: false, has Authorization header: false
2026-06-21T15:17:29.109Z [DEBUG] [API:auth] OAuth token check starting
2026-06-21T15:17:29.111Z [DEBUG] Ripgrep first use test: PASSED (mode=embedded, path=C:\Users\Administrator\AppData\Roaming\npm\node_modules\@anthropic-ai\claude-code\bin\claude.exe)
2026-06-21T15:17:29.111Z [DEBUG] [API:auth] OAuth token check complete
2026-06-21T15:17:29.112Z [DEBUG] Fast mode unavailable: Fast mode is not available in the Agent SDK
2026-06-21T15:17:29.113Z [DEBUG] [API:timing] dispatching to firstParty model=claude-haiku-4-5
2026-06-21T15:17:29.116Z [DEBUG] [API REQUEST] /v1/messages source=sdk
2026-06-21T15:17:29.768Z [DEBUG] Stream started - received first chunk
2026-06-21T15:17:29.768Z [DEBUG] [API:timing] first byte after 793ms
2026-06-21T15:17:30.688Z [ERROR] MCP server "rpgmaker-mv" Server stderr: [2026-06-21T15:17:30.664Z] [INFO] Starting RPG Maker MV MCP Server...
[2026-06-21T15:17:30.669Z] [INFO] Project path: D:/Games/RpgMaker/Game/不洁圣女
[2026-06-21T15:17:30.676Z] [INFO] RPG Maker MV MCP server v5.11.2 running on stdio (12 tools)
2026-06-21T15:17:30.688Z [DEBUG] MCP server "rpgmaker-mv": Successfully connected (transport: stdio) in 1960ms
2026-06-21T15:17:30.688Z [DEBUG] MCP server "rpgmaker-mv": Connection established with capabilities: {"hasTools":true,"hasPrompts":false,"hasResources":false,"hasResourceSubscribe":false,"serverVersion":{"name":"rpgmaker-mv-mcp","version":"5.11.2"}}
2026-06-21T15:17:30.689Z [DEBUG] [MCP] Server "rpgmaker-mv" connected with subscribe=false
2026-06-21T15:17:30.957Z [DEBUG] [mcp-registry] Loaded 0 official MCP URLs (legacy)
2026-06-21T15:17:35.797Z [DEBUG] Stream started - received first chunk
2026-06-21T15:17:35.797Z [DEBUG] [API:timing] first byte after 6685ms
2026-06-21T15:17:37.779Z [INFO] [Stall] tool_dispatch_start tool=ToolSearch toolUseId=call_00_OG1KUaxPsuFqdqzTREAe5504 permissionDecisionMs=0
2026-06-21T15:17:37.780Z [DEBUG] ToolSearchTool: cache invalidated - deferred tools changed
2026-06-21T15:17:37.783Z [DEBUG] ToolSearchTool: keyword search for "rpgmaker", found 12 matches
2026-06-21T15:17:37.784Z [INFO] [Stall] tool_dispatch_end tool=ToolSearch toolUseId=call_00_OG1KUaxPsuFqdqzTREAe5504 outcome=ok durationMs=5
2026-06-21T15:17:37.797Z [DEBUG] LSP Diagnostics: getLSPDiagnosticAttachments called
2026-06-21T15:17:37.797Z [DEBUG] LSP Diagnostics: Checking registry - 0 pending
2026-06-21T15:17:37.797Z [DEBUG] Hooks: Found 0 total hooks in registry
2026-06-21T15:17:37.798Z [DEBUG] Hooks: checkForNewResponses returning 0 responses
2026-06-21T15:17:37.801Z [DEBUG] Dynamic tool loading: found 12 discovered tools in message history
2026-06-21T15:17:37.802Z [DEBUG] Dynamic tool loading: 12/30 deferred tools included
2026-06-21T15:17:37.803Z [DEBUG] attribution header x-anthropic-billing-header: cc_version=2.1.185.781; cc_entrypoint=sdk-cli;
2026-06-21T15:17:37.803Z [DEBUG] Fast mode unavailable: Fast mode is not available in the Agent SDK
2026-06-21T15:17:37.803Z [DEBUG] Fast mode unavailable: Fast mode is not available in the Agent SDK
2026-06-21T15:17:37.804Z [DEBUG] [API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: false, has Authorization header: false
2026-06-21T15:17:37.804Z [DEBUG] [API:auth] OAuth token check starting
2026-06-21T15:17:37.805Z [DEBUG] [API:auth] OAuth token check complete
2026-06-21T15:17:37.805Z [DEBUG] Fast mode unavailable: Fast mode is not available in the Agent SDK
2026-06-21T15:17:37.806Z [DEBUG] [API:timing] dispatching to firstParty model=claude-haiku-4-5
2026-06-21T15:17:37.807Z [DEBUG] [API REQUEST] /v1/messages source=sdk
2026-06-21T15:17:45.135Z [DEBUG] Stream started - received first chunk
2026-06-21T15:17:45.135Z [DEBUG] [API:timing] first byte after 7330ms
2026-06-21T15:17:45.382Z [ERROR] 1P event logging: 105 events failed to export (status=403, code=ERR_BAD_REQUEST, Request failed with status code 403)
2026-06-21T15:17:45.382Z [ERROR] [3P telemetry] OTEL diag error: {"message":"Failed to export 105 events (status=403, code=ERR_BAD_REQUEST, Request failed with status code 403)","originalLine":"478","originalColumn":"1756","line":"478","column":"1756","sourceURL":"B:/~BUN/root/src/entrypoints/cli.js","stack":"Error: Failed to export 105 events (status=403, code=ERR_BAD_REQUEST, Request failed with status code 403)\n at doExport (B:/~BUN/root/src/entrypoints/cli.js:478:1756)\n at processTicksAndRejections (native:7:39)","name":"Error"}
2026-06-21T15:17:47.958Z [INFO] [Stall] tool_dispatch_start tool=mcp__rpgmaker-mv__get_project_context toolUseId=call_00_jxwExnyIeFA4suTOStE34992 permissionDecisionMs=0
2026-06-21T15:17:47.959Z [DEBUG] MCP server "rpgmaker-mv": Calling MCP tool: get_project_context
2026-06-21T15:17:47.973Z [DEBUG] MCP server "rpgmaker-mv": Tool 'get_project_context' completed successfully in 14ms
2026-06-21T15:17:47.974Z [INFO] [Stall] tool_dispatch_end tool=mcp__rpgmaker-mv__get_project_context toolUseId=call_00_jxwExnyIeFA4suTOStE34992 outcome=ok durationMs=16
2026-06-21T15:17:47.975Z [DEBUG] Permission suggestions for mcp__rpgmaker-mv__manage_system: [
{
"type": "addRules",
"rules": [
{
"toolName": "mcp__rpgmaker-mv__manage_system"
}
],
"behavior": "allow",
"destination": "localSettings"
}
]
2026-06-21T15:17:47.976Z [DEBUG] mcp__rpgmaker-mv__manage_system tool permission denied
2026-06-21T15:17:47.977Z [DEBUG] Permission suggestions for mcp__rpgmaker-mv__query_map: [
{
"type": "addRules",
"rules": [
{
"toolName": "mcp__rpgmaker-mv__query_map"
}
],
"behavior": "allow",
"destination": "localSettings"
}
]
2026-06-21T15:17:47.978Z [DEBUG] mcp__rpgmaker-mv__query_map tool permission denied
2026-06-21T15:17:47.984Z [DEBUG] LSP Diagnostics: getLSPDiagnosticAttachments called
2026-06-21T15:17:47.984Z [DEBUG] LSP Diagnostics: Checking registry - 0 pending
2026-06-21T15:17:47.984Z [DEBUG] Hooks: Found 0 total hooks in registry
2026-06-21T15:17:47.985Z [DEBUG] Hooks: checkForNewResponses returning 0 responses
2026-06-21T15:17:47.989Z [DEBUG] Dynamic tool loading: found 12 discovered tools in message history
2026-06-21T15:17:47.990Z [DEBUG] Dynamic tool loading: 12/30 deferred tools included
2026-06-21T15:17:47.991Z [DEBUG] attribution header x-anthropic-billing-header: cc_version=2.1.185.781; cc_entrypoint=sdk-cli;
2026-06-21T15:17:47.991Z [DEBUG] Fast mode unavailable: Fast mode is not available in the Agent SDK
2026-06-21T15:17:47.991Z [DEBUG] Fast mode unavailable: Fast mode is not available in the Agent SDK
2026-06-21T15:17:47.992Z [DEBUG] [API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: false, has Authorization header: false
2026-06-21T15:17:47.992Z [DEBUG] [API:auth] OAuth token check starting
2026-06-21T15:17:47.993Z [DEBUG] [API:auth] OAuth token check complete
2026-06-21T15:17:47.994Z [DEBUG] Fast mode unavailable: Fast mode is not available in the Agent SDK
2026-06-21T15:17:47.994Z [DEBUG] [API:timing] dispatching to firstParty model=claude-haiku-4-5
2026-06-21T15:17:47.996Z [DEBUG] [API REQUEST] /v1/messages source=sdk
2026-06-21T15:17:54.215Z [DEBUG] Stream started - received first chunk
2026-06-21T15:17:54.215Z [DEBUG] [API:timing] first byte after 6221ms
2026-06-21T15:17:57.111Z [ERROR] 1P event logging: 24 events failed to export (status=403, code=ERR_BAD_REQUEST, Request failed with status code 403)
2026-06-21T15:17:57.111Z [ERROR] [3P telemetry] OTEL diag error: {"message":"Failed to export 24 events (status=403, code=ERR_BAD_REQUEST, Request failed with status code 403)","originalLine":"478","originalColumn":"1756","line":"478","column":"1756","sourceURL":"B:/~BUN/root/src/entrypoints/cli.js","stack":"Error: Failed to export 24 events (status=403, code=ERR_BAD_REQUEST, Request failed with status code 403)\n at doExport (B:/~BUN/root/src/entrypoints/cli.js:478:1756)\n at processTicksAndRejections (native:7:39)","name":"Error"}
2026-06-21T15:18:01.423Z [DEBUG] Fast mode unavailable: Fast mode is not available in the Agent SDK
2026-06-21T15:18:01.425Z [DEBUG] MCP server "rpgmaker-mv": Terminating MCP server process tree
2026-06-21T15:18:01.462Z [DEBUG] MCP server "rpgmaker-mv": UNKNOWN connection closed after 30s (cleanly)
2026-06-21T15:18:01.462Z [DEBUG] MCP server "rpgmaker-mv": Cleared connection cache for reconnection
2026-06-21T15:18:01.465Z [DEBUG] LSP server manager shut down successfully
2026-06-21T15:18:01.466Z [ERROR] Failed to check metrics opt-out status: Auth error: No API key available
2026-06-21T15:18:01.467Z [DEBUG] Metrics export disabled by organization setting
2026-06-21T15:18:01.467Z [DEBUG] BigQuery metrics exporter flush complete
2026-06-21T15:18:01.467Z [DEBUG] BigQuery metrics exporter flush complete
2026-06-21T15:18:01.467Z [DEBUG] BigQuery metrics exporter shutdown complete
Steps to Reproduce
Reproductions
Repro A — independent stdio client proves the server is clean under concurrency
D:\Games\RpgMaker\.mcp-repro\repro.mjs spawns the real server process and drives it with a
correct NDJSON reader (split on 0x0a, parse each line, correlate by id). It fires
4 tools/call requests back-to-back on stdin without waiting (true parallel burst),
then collects responses.
Result:
=== A: PARALLEL 4x get_project_context ===
raw frames total : 4
parse OK / malformed : 4 / 0
merged-signature frames: 0 (no line contained >1 "jsonrpc" key)
expected resp ids : [4,5,6,7]
got resp ids : [4,5,6,7]
ids match : true
=== B: SERIAL 4x get_project_context ===
raw frames total : 4
parse OK / malformed : 4 / 0
merged-signature frames: 0
ids match : true
Server stderr during the parallel burst (note the 4 Tool call lines land in the same
millisecond, but succeeded is staggered — the queue serialized them, no overlap):
[15:12:59.435Z] Tool call: get_project_context
[15:12:59.435Z] Tool call: get_project_context
[15:12:59.438Z] Tool call succeeded
[15:12:59.442Z] Tool call succeeded
[15:12:59.446Z] Tool call succeeded
[15:12:59.451Z] Tool call succeeded
→ A correct reader sees zero malformed frames and perfect id correlation under a true
parallel burst. The wire is clean.
Repro B — live Claude Code session (intermittent)
In a live Claude Code session, parallel read-only MCP calls (get_project_context +query_database) returned valid JSON on every attempt tried, i.e. the race did not bite
during sampling. This is expected for an intermittent client-side race and is consistent
with (not contradictory to) the diagnosis.
Repro C — tee proxy to capture the exact frame Claude Code chokes on (ready to deploy)
D:\Games\RpgMaker\.mcp-repro\tee-wrapper.mjs is a byte-faithful stdio proxy: it forwards
the server's stdout to Claude Code verbatim and immediately, while frame-splitting a
copy to tee.stdout.log (each logged frame records its length and a jsonrpc-keys count,
where >1 would mean two frames were merged on the wire).
To capture the smoking gun:
- Point
.mcp.jsonat the wrapper:
``json``
{
"mcpServers": {
"rpgmaker-mv": {
"command": "node",
"args": ["D:/Games/RpgMaker/.mcp-repro/tee-wrapper.mjs",
"C:/Users/Administrator/AppData/Local/npm-cache/_npx/af18711cab0c2357/node_modules/rpgmaker-mv-mcp/dist/index.js"],
"env": { "RPGMAKER_PROJECT_PATH": "D:/Games/RpgMaker/Game/不洁圣女" }
}
}
}
- Run Claude Code with full debug logging to a file:
claude --debug --debug-file cc-debug.log
(or claude -d mcp for the MCP category — --mcp-debug is deprecated in favor of --debug).
- Reproduce parallel MCP calls until a malformed-JSON error appears.
- Inspect
tee.stdout.log: the frame Claude Code choked on will be present as a clean,
single-jsonrpc frame — proving the bytes were correct when they left the pipe and the
malformation was introduced client-side. Cross-reference with any JSON-parse error line
in cc-debug.log.
Because the proxy adds nothing to its own stdout except the server's forwarded bytes, it
cannot itself introduce malformation.
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.185 (Claude Code)
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
_No response_
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗