Skip to content

DF0043: Invalid RPC Argument

Message

RPC function "{name}" received an invalid argument at position {index}: {issues}

Cause

When an RPC function declares args schemas, each incoming argument is validated against its positional Standard Schema (valibot, zod, arktype, …) before the handler runs — on every path: local calls, over-the-wire calls, and the agent/MCP bridge. The argument at {index} failed that schema. Validation guards the payload without rewriting it, so extra object fields the schema doesn't mention still reach the handler.

Example

ts
const greet = defineRpcFunction({
  name: 'greet',
  args: [v.string()],
  returns: v.string(),
  handler: name => `hi ${name}`,
})

// ✓ Good
await ctx.rpc.functions.greet('ada')

// ✗ Bad — a number where a string is required → DF0043 at position 0
await ctx.rpc.functions.greet(42 as never)

Fix

Pass a value that satisfies the args schema declared for the function, or widen the schema if the value is legitimately allowed.

Source

Released under the MIT License.