---
outline: deep
---

# DF0044: Invalid RPC Return Value

## Message

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

## Cause

When an RPC function declares a `returns` schema, the handler's resolved value is validated against that [Standard Schema](https://standardschema.dev/) (valibot, zod, arktype, …) before it is sent back to the caller. The value the handler produced does not satisfy the schema — a bug in the handler or a schema that is narrower than the real result. Validation guards the payload without rewriting it, so a value that merely carries extra object fields is accepted.

## Example

```ts
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

- [`packages/devframe/src/rpc/validate-io.ts`](https://github.com/devframes/devframe/blob/main/packages/devframe/src/rpc/validate-io.ts) — `validateRpcReturn()` throws `DF0044` when the handler's resolved value fails its declared schema.
