DF0044: Invalid RPC Return Value

RPC function "{name}" returned a value that failed its returns schema: {issues}

Message

RPC function "{name}" returned a value that failed its returns schema: {issues}

Cause

A declared returns schema validates the handler's resolved value before it goes back to the caller. The value failed the schema, whether from a bug in the handler or a schema narrower than the real result. Validation guards without rewriting, so a value carrying extra object fields is accepted.

Example

const count = defineRpcFunction({
  name: 'count',
  args: [],
  returns: v.number(),
  /** ✗ Bad: returns a string where a number is declared → DF0044 */
  handler: () => 'twelve' as never,
})

Fix

Make the handler return a value that satisfies the returns schema, or relax the schema so it describes the value the handler actually produces.

Source