When a built-in spec method receives schema-invalid params (e.g. logging/setLevel with { level: 'not-a-level' }), the dispatch-time parse failure (protocol.ts:915) escapes as a raw ZodError and hits the generic wrap (protocol.ts:562), which defaults non-numeric codes to -32603 InternalError.
JSON-RPC 2.0 assigns invalid method parameters -32602, so callers sending bad params are currently told the server broke rather than that their params were wrong.
Mapping the dispatch-time parse failure to ProtocolError(InvalidParams) fixes it. Wire-visible, so it needs a changeset — deployed peers may match on the current -32603.
When a built-in spec method receives schema-invalid params (e.g.
logging/setLevelwith{ level: 'not-a-level' }), the dispatch-time parse failure (protocol.ts:915) escapes as a raw ZodError and hits the generic wrap (protocol.ts:562), which defaults non-numeric codes to -32603 InternalError.JSON-RPC 2.0 assigns invalid method parameters -32602, so callers sending bad params are currently told the server broke rather than that their params were wrong.
Mapping the dispatch-time parse failure to
ProtocolError(InvalidParams)fixes it. Wire-visible, so it needs a changeset — deployed peers may match on the current -32603.