[BUG] 404 for Invalid Session ID should trigger a new session

Status Closed — not planned
Maintainer reply None cached
Activity 8 comments · opened Sep 29, 2025 · closed Jan 22, 2026

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?

The latest MCP specification 2025-06-18 mentions in Trasports // 2.5 Session Management (4) that:

When a client receives HTTP 404 in response to a request containing an Mcp-Session-Id, it MUST start a new session by sending a new InitializeRequest without a session ID attached.

Current behavior using Claude Code is to just report the error and quit.

⏺ myserver - time_get_current_time (MCP)(timezone: "America/New_York")
  ⎿  Error: Error POSTing to endpoint (HTTP 404): 
     {"jsonrpc":"2.0","error":{"code":-32000,"message":"No valid session ID provided"},"id":null}

⏺ The error persists.

What Should Happen?

Claude Code to initialize a new session / reconnect to the MCP server and continue.

Error Messages/Logs

Steps to Reproduce

Preparations:

  1. Set up a local MCP server in-memory only session management, like https://github.com/modelcontextprotocol/typescript-sdk/blob/main/src/examples/server/sseAndStreamableHttpCompatibleServer.ts
  2. claude mcp add --transport http myserver http://localhost:{port}/mcp

Steps:

  1. Start claude. Verify that the mcp is connected /mcp
  2. Close the MCP server and open again
  3. Try to call a tool from the server

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

1.0.128 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

8 Comments

he-commits · 1 year ago

Hi! Have you found a solution?

nirhaas · 1 year ago

Not at the moment.

github-actions[bot] · 10 months ago

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

zweischritte · 10 months ago

It is still happening, still an issue.

hortovanyi · 9 months ago

I raised a separate BUG issue but have closed it .. after upgrading to Claude Code 2.0.75 it would not longer connect to my 2025-06-18 specced server. Upgraded my MCP server to handle the latest MCP Spec 2025-11-25 but then this issue started - have changed my MCP server to timeout sessions now after 4 hours instead of 30 minutes ... Claude Code hangs when the session-expired error is returned

github-actions[bot] · 8 months ago

This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.

marcindulak · 8 months ago

This issue was closed incorrectly despite recent human comments. This behavior of the bot is reported at https://github.com/anthropics/claude-code/issues/16497. Please upvote that issue, so maybe it gets noticed.

github-actions[bot] · 8 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.