---
title: "DF0080: Agent In-Page Function Not JSON-Serializable"
description: "An in-page channel function sets `agent` but `jsonSerializable` is `false`."
canonical_url: "https://devfra.me/errors/df0080"
---
# DF0080: Agent In-Page Function Not JSON-Serializable

> An in-page channel function sets \`agent\` but \`jsonSerializable\` is \`false\`.

## Message

> In-page channel function "" has `agent` set but `jsonSerializable` is `false`; MCP requires JSON-serializable data.

## Cause

The `agent` field exposes an in-page function over the browser-to-node agent bridge and MCP, which only consumes JSON-shaped data, so it implicitly enables strict JSON serialization. An explicit `jsonSerializable: false` conflicts with that contract.

## Example

```ts
import { createPageScriptChannel } from 'devframe/in-page-channel'

createPageScriptChannel({
  name: 'devframes:example',
  functions: {
    addTodo: {
      agent: { description: 'Add a todo item.' },
      jsonSerializable: false, // ✗ throws DF0080
      handler: (text: string) => ({ added: text }),
    },
  },
})
```

## Fix

Remove `jsonSerializable: false` to use the implicit JSON contract, or remove `agent` to keep the function channel-only.

```ts
const addTodo = {
  agent: { description: 'Add a todo item.' }, // jsonSerializable is inferred true
  handler: (text: string) => ({ added: text }),
}
```

## Source

- [`packages/devframe/src/in-page-channel/internal.ts`](https://github.com/devframes/devframe/blob/main/packages/devframe/src/in-page-channel/internal.ts): `createLocalFunctionRegistry().register()` throws this when a definition combines `agent` with `jsonSerializable: false`, and infers `jsonSerializable: true` otherwise.


## Sitemap

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