---
outline: deep
---

# DF0021: RPC Function Already Registered

## Message

> RPC function "`{name}`" is already registered

## Cause

`ctx.rpc.register()` was called twice with the same `name`. RPC names must be unique within a devtool.

## Fix

Either give the second registration a distinct name, or pass `force: true` to overwrite the previous one (e.g. during HMR-driven re-registration).

```ts
ctx.rpc.register(defineRpcFunction({ name: 'my-plugin:fn', handler: () => 1 }), true /* force */)
```

## Source

- [`packages/devframe/src/rpc/collector.ts`](https://github.com/devframes/devframe/blob/main/packages/devframe/src/rpc/collector.ts) — `RpcFunctionsCollectorBase.register()` throws `DF0021` when an RPC name is already registered and `force` is not set.
