---
outline: deep
---

# DF0039: Duplicate JSON-Render View

## Message

> A JSON-render view with id "`{id}`" already exists in scope "`{scope}`".

## Cause

Each JSON-render view has a stable, author-supplied id that forms its shared-state key `devframe:json-render:<scope>:<id>`. Ids must be unique within a scope so the client keeps a stable subscription across reconnects. Creating a second view with the same id in the same scope throws instead of clobbering the first.

## Example

```ts
// ✗ Bad — same id twice in the same scope
createJsonRenderView(ctx, { id: 'metrics', spec })
createJsonRenderView(ctx, { id: 'metrics', spec }) // DF0039

// ✓ Good — dispose the previous view first, or use a distinct id
const view = createJsonRenderView(ctx, { id: 'metrics', spec })
view.dispose()
createJsonRenderView(ctx, { id: 'metrics', spec })
```

## Fix

Give each view a stable id unique within its scope, or dispose the previous view before recreating it. Scope defaults to the context namespace (or `global`); pass `scope` to isolate ids explicitly.

## Source

- [`packages/json-render/src/node/create-view.ts`](https://github.com/devframes/devframe/blob/main/packages/json-render/src/node/create-view.ts) — `createJsonRenderView()` throws this when the scoped id is already live.
