[BUG] When Claude Code receives HTTP 404 with a session ID error from an MCP server it should start a new session but it doesn'ty.
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?
Claude Code V2.0.17
Using an MCP server that works fine with GitHub Co-pilot I get error with Claude Code.
MCP server is HTTP only. It works for a bit then I get: Error: Error POSTing to endpoint (HTTP 404): {"error":{"code":-32001,"message":"Session not found"},"id":"","jsonrpc":"2.0"}
Claude Code diagnosis is:
According to the MCP spec: When a server terminates a session, it responds with HTTP 404. When Claude Code receives HTTP 404 with a session ID error, it should start a new session by sending a new InitializeRequest without a session ID, but it's not doing that properly.
Your MCP server is likely returning 404 "Session not found" (correctly per spec), but Claude Code isn't re-initializing the session like it should. Other clients handle this correctly, which is why it works elsewhere.
Solutions
- Update Claude Code - Check if you're on the latest version
- File a bug report at https://github.com/anthropics/claude-code/issues with your specific Forrit CMS server details
- Ask Forrit CMS if they can add stdio transport support as a workaround
This is definitely a Claude Code bug, not your configuration. (Claude's opinion not mine)
What Should Happen?
It should start a new session by sending a new InitializeRequest without a session ID
Error Messages/Logs
Error: Error POSTing to endpoint (HTTP 404): {"error":{"code":-32001,"message":"Session not found"},"id":"","jsonrpc":"2.0"}
Steps to Reproduce
Give the agent a task to do that requires extensive use of the MCP server and at some point it will hit this error and not recover
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.0.17
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
VS Code integrated terminal
Additional Information
this issue occurs in either the Claude Code running on WSL2 or the integrated VSCode plugin for Claude Code
This issue has 8 comments on GitHub. Read the full discussion on GitHub ↗