The Ruby SDK server returns JSON-RPC error responses for several malformed JSON-RPC envelope cases, but those responses use id:null even when the incoming payload contains a concrete request id.
From a JSON-RPC client's perspective, the original request remains pending because no response with the matching id arrives. The server itself remains usable and continues to process subsequent requests.
Tested with:
- stable release
v0.18.0 (3ff237a02c0792bbfbcacef5e37c0c7529c1f2a5) - Transports: stdio and Streamable HTTP
To Reproduce
- Start a server over stdio or Streamable HTTP.
- Complete a normal initialization flow.
- Send these requests in isolation:
{"jsonrpc":"1.0","id":3,"method":"ping","params":{}}
{"id":4,"method":"ping","params":{}}
{"jsonrpc":"2.0","id":8,"method":12345,"params":{}}Expected behavior
For valid JSON payloads where the top-level request id is present and recoverable, it would be helpful for the JSON-RPC error response to preserve that id so clients can correlate the response with the pending request.
Logs
| Case | Sent | Server response |
|---|
wrong jsonrpc version | {"jsonrpc":"1.0","id":3,...} | {"jsonrpc":"2.0","id":null,"error":{"code":-32600,"message":"Invalid Request","data":"JSON-RPC version must be 2.0"}} |
missing jsonrpc field | {"id":4,"method":"ping",...} | {"jsonrpc":"2.0","id":null,"error":{"code":-32600,"message":"Invalid Request","data":"JSON-RPC version must be 2.0"}} |
method as number | {"jsonrpc":"2.0","id":8,"method":12345,...} | {"jsonrpc":"2.0","id":null,"error":{"code":-32600,"message":"Invalid Request","data":"Method name must be a string and not start with \"rpc.\""}} |
In all three cases, subsequent pings received correct responses — the server remained usable.
The Ruby SDK server returns JSON-RPC error responses for several malformed JSON-RPC envelope cases, but those responses use
id:nulleven when the incoming payload contains a concrete request id.From a JSON-RPC client's perspective, the original request remains pending because no response with the matching id arrives. The server itself remains usable and continues to process subsequent requests.
Tested with:
v0.18.0(3ff237a02c0792bbfbcacef5e37c0c7529c1f2a5)To Reproduce
{"jsonrpc":"1.0","id":3,"method":"ping","params":{}} {"id":4,"method":"ping","params":{}} {"jsonrpc":"2.0","id":8,"method":12345,"params":{}}Expected behavior
For valid JSON payloads where the top-level request id is present and recoverable, it would be helpful for the JSON-RPC error response to preserve that id so clients can correlate the response with the pending request.
Logs
jsonrpcversion{"jsonrpc":"1.0","id":3,...}{"jsonrpc":"2.0","id":null,"error":{"code":-32600,"message":"Invalid Request","data":"JSON-RPC version must be 2.0"}}jsonrpcfield{"id":4,"method":"ping",...}{"jsonrpc":"2.0","id":null,"error":{"code":-32600,"message":"Invalid Request","data":"JSON-RPC version must be 2.0"}}methodas number{"jsonrpc":"2.0","id":8,"method":12345,...}{"jsonrpc":"2.0","id":null,"error":{"code":-32600,"message":"Invalid Request","data":"Method name must be a string and not start with \"rpc.\""}}In all three cases, subsequent pings received correct responses — the server remained usable.