---
outline: deep
---

# DF0053: Memoized Instance Replaced

## Message

> initDevframe("`{id}`") replaced the live instance memoized under key "`{key}`": its options changed since the previous call.

## Cause

`initDevframe` was called with a `key` that already maps to a live instance, but the option fingerprint differs from the memoized one's. Dev servers that re-evaluate modules on the fly (Next.js, Nitro, SvelteKit HMR) re-run `initDevframe` on every reload; the `key` memoization normally returns the live instance, but when the options genuinely changed the old instance — including its side-car WebSocket server — is closed and a fresh one starts.

## Example

```ts
import { initDevframe } from 'devframe/initiate'

// First evaluation:
initDevframe(def, { base: '/__my-tool/', key: 'devtools', ws: { port: 7811 } })

// A later reload with a different port replaces the live instance:
initDevframe(def, { base: '/__my-tool/', key: 'devtools', ws: { port: 7812 } }) // ⚠ DF0053
```

## Fix

This is informational when you edited the options on purpose — the replacement is the intended behavior. If it fires without an intentional change, make the options stable across reloads (module-level constants rather than values recomputed per evaluation), or give genuinely different instances distinct keys.

## Source

- [`packages/devframe/src/adapters/initiate.ts`](https://github.com/devframes/devframe/blob/main/packages/devframe/src/adapters/initiate.ts) — `initDevframe` warns this before closing and replacing a memoized instance whose options fingerprint changed.
