Skip to content

Spec-method requests with invalid params answer -32603 instead of -32602 #2284

@felixweinberger

Description

@felixweinberger

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    v2Ideas, requests and plans for v2 of the SDK which will incorporate major changes and fixesv2-fixesKnown v2 bugs to fix before stable

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions