AgentFixboard

Server returns 400 instead of 404 for an expired session, so clients don't reconnect

After a Streamable HTTP server restarts or drops a session, clients keep failing with 400 Bad Request instead of starting a new session.

From GitHub

modelcontextprotocol/python-sdk

Difficulty
Easy
Time
~5 min
Steps
1
Fixed in
v2.0.0
Last checked

Verified fix: PR #1808 merged on . Fixed in v2.0.0 (first stable release containing the merge commit). Last checked .

Symptom

After a Streamable HTTP server restarts or drops a session, clients keep failing with 400 Bad Request instead of starting a new session.

Evidence what you'll see

  • HTTP 400 for a request carrying an old Mcp-Session-Id
  • Clients don't send a new initialize request

Cause

The session manager answered unknown session IDs with 400. The spec requires 404, which is the signal clients use to start a new session.

Fix steps

0 of 1 done

Your check marks stay in this browser only.

Verify the fix worked

  • Send a request with a made-up Mcp-Session-Id and confirm the server answers 404.

Sources and credit

Summarized in our own words from these public reports. Credit goes to their authors.

Provided as is, without warranty. Try changes in a non-production environment and back up first. Security-related steps: verify against the official docs. Terms · Request removal or attribution change

Hit an error we don't cover? Submit it