Agent FixboardAgentFixboard

ClosedResourceError in server logs when a request fails validation early

A Streamable HTTP request that fails validation early raises ClosedResourceError from the message router. The report says this starts in v1.12.0 and shows up on a bad Accept header.

From GitHub

modelcontextprotocol/python-sdk

Difficulty
Easy
Time
~5 min
Steps
1
Fixed in
v1.23.2
Last checked

Verified fix: PR #1384 merged on . Fixed in v1.23.2 (first published release whose tag contains the merge commit). Last checked .

Symptom

A Streamable HTTP request that fails validation early raises ClosedResourceError from the message router. The report says this starts in v1.12.0 and shows up on a bad Accept header.

Evidence what you'll see

  • The notes in the issue are against v1.14.0 with anyio==4.10.0. The router loop is async for write_stream_reader around line 831 of streamable_http.py.
  • The environment block says python==3.12.0.

Why it happens

The message router keeps reading after the request task has already closed the stream, so a fast failure races the router's next read.

Affected versions

MCP Python SDK from v1.12.0, the write-up is against v1.14.0, anyio==4.10.0, Python 3.12.0. The linked issue does not name an operating system.

Fix steps

0 of 1 done

Your check marks stay in this browser only.

How to check it worked

  • A request rejected for its Accept header does not raise ClosedResourceError from the message router.

If it still fails

  • The linked issue does not describe ClosedResourceError on v1.23.2. A client that never sends Accept still fails validation; it should not take the router down with it.

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