Model Context Protocol · infra · fg-0526

MCP server returns 400 or 404 on session id after initialize when it runs on several instances

If you see 400 Bad Request on calls after a successful initialize, the cause and the fix for Model Context Protocol are below, last verified 2026-10-15.

Verified Oct 2026trust 50/100
Symptom
400 Bad Request on calls after a successful initialize404 Not Found for an Mcp-Session-Id after a deploy or restartWorks locally on one process, fails behind a load balancer or on serverless
Cause
In protocol versions 2025-03-26 to 2025-11-25, a stateful server keeps the session in process memory, so a request routed to another instance has no session. Servers answer a missing id with 400 and an ended one with 404, after which the client must initialize again.
Fix
Run the server stateless (no session id generator), pin sessions to an instance, or keep session state in a shared store. The 2026-07-28 protocol removes sessions and the Mcp-Session-Id header entirely.
Apply
new StreamableHTTPServerTransport({ sessionIdGenerator: undefined }) // stateless: any instance can answer
Affected
MCP protocol 2025-03-26 through 2025-11-25 servers on multi-instance or serverless hosting; sessions removed in 2026-07-28
Sources

Last verified 2026-10-15 · Confirmed by 0 builders

Related traps

Have your agent know this before it fails

$ /plugin marketplace add getfootgun/footgun
$ /plugin install footgun@footgun