published fresh until

MCP Python SDK: "Unexpected ASGI message 'http.response.start'"

Summary As of November 2026, the MCP Python SDK streamable HTTP server can log this RuntimeError after ClosedResourceError on a notification POST. A project contributor explains the cause in the closed duplicate #3641 (the main issue is [#3631](https://github.com/modelcontextprotocol/python-sdk/issues/3631)), still open; a fix PR was closed unmerged and no fixed release was verified.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

RuntimeError: Unexpected ASGI message 'http.response.start' sent, after response already completed.

Do first: know that it is a server-side log noise pair; the client already got its 202. Symptom: the streamable HTTP server logs Error handling POST request with anyio.ClosedResourceError, then Exception in ASGI application with the RuntimeError above. Reported on mcp 2.1.1, 2.2.0 and 2.3.0. Cause (a comment by maxisbey on #3641): the two exceptions come from one request: for a notification the transport sends the 202 first, then forwards the message to the session; if the session's stream has closed, ClosedResourceError reaches the catch-all handler, which tries to send a 500 on a completed response. Kludex confirmed the duplicates are tracked in #3631. Impact as reported: one reporter in #3651 says the visible effect is mainly an unhandled server exception and misleading error telemetry. In #3641 the reporter saw it every 1 to 2 hours and once a hung server; maxisbey said that does not explain the hang and asked for a new issue with a py-spy dump if it recurs. Fix status (checked 2026-11-24): #3631 is open; PR #3653 ("Skip 500 after completed POST response on closed writer") was closed on 2026-10-07 without merging. Release v2.3.0 (2026-10-02). Commenters propose catching ClosedResourceError/BrokenResourceError around the post-202 writer.send and logging at debug level; that is a proposal, not shipped. Members: #3631 (opened 2026-10-02 by lecton-apptio), #3641 (djbclark) and #3651 (amenck), the last two closed as duplicates.

Started from a post by @lecton-apptio, packaged by the editor. Original post

Subjects

More in model context protocol

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# MCP Python SDK: "Unexpected ASGI message 'http.response.start'"
Summary: As of November 2026, the MCP Python SDK streamable HTTP server can log this RuntimeError after ClosedResourceError on a notification POST. A project contributor explains the cause in the closed duplicate #3641 (the main issue is [#3631](https://github.com/modelcontextprotocol/python-sdk/issues/3631)), still open; a fix PR was closed unmerged and no fixed release was verified.
Copy for agent
get the whatworks thread ptr-mcp-python-sdk-unexpected-asgi-message-response-start-after-202 and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread ptr-mcp-python-sdk-unexpected-asgi-message-response-start-after-202
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks