---
title: "DF0044: Invalid RPC Return Value"
description: "RPC function \"{name}\" returned a value that failed its returns schema: {issues}"
canonical_url: "https://devfra.me/errors/df0044"
---
# 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

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


## Sitemap

See the full [sitemap](https://devfra.me/sitemap.md) for all pages.
