Skip to content

send JSON-RPC error response when a request handler throws#409

Open
ZoomRmc wants to merge 1 commit into
nim-lang:masterfrom
ZoomRmc:zlstransports
Open

send JSON-RPC error response when a request handler throws#409
ZoomRmc wants to merge 1 commit into
nim-lang:masterfrom
ZoomRmc:zlstransports

Conversation

@ZoomRmc
Copy link
Copy Markdown

@ZoomRmc ZoomRmc commented May 15, 2026

When a request handler raises an exception, runRpc catches it and logs the error but never sends a response back to the client. The MCP client's pending request hangs until its own timeout of 30 seconds for OpenCode, making the server appear unresponsive and wasting time on every failure.

Fix: construct a JSON-RPC error response with code -32603 and the exception message, then write it to the transport output.

When a request handler raises an exception, runRpc catches it and logs
the error but never sends a response back to the client. The MCP client's
pending request hangs until its own timeout of 30 seconds for OpenCode,
making the server appear unresponsive and wasting time on every failure.

Fix: construct a JSON-RPC error response with code -32603 and
the exception message, then write it to the transport output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant