Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Log warning for unhandled exceptions in default message handler
Transport errors that are not tied to a specific pending request (e.g.,
GET stream failures) were silently swallowed by the default message
handler. Add a warning log so these exceptions are at least visible in
logs as an observability safety net.

Github-Issue: #1401
  • Loading branch information
heyhayes committed Feb 21, 2026
commit ae0bc81a22ba997a2de1eac6c6fd83b58594f37d
2 changes: 2 additions & 0 deletions src/mcp/client/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ async def __call__(
async def _default_message_handler(
message: RequestResponder[types.ServerRequest, types.ClientResult] | types.ServerNotification | Exception,
) -> None:
if isinstance(message, Exception):
logger.warning("Unhandled exception in message handler: %s", message)
await anyio.lowlevel.checkpoint()


Expand Down
Loading