---
title: "DF8401: Cannot Change Command Id"
description: "Cannot change the id of a command. Use register() to add new commands"
canonical_url: "https://devfra.me/errors/df8401"
---
# DF8401: Cannot Change Command Id

> Cannot change the id of a command. Use register() to add new commands

## Message

> Cannot change the id of a command. Use register() to add new commands

## Cause

The `update` handle returned by `ctx.commands.register(cmd)` received a patch with an `id` key. Command ids are immutable post-registration.

## Fix

- Drop `id` from the patch object.
- To register a new command, call `ctx.commands.register(newCmd)`.

## Source

- [`packages/hub/src/node/host-commands.ts`](https://github.com/devframes/devframe/blob/main/packages/hub/src/node/host-commands.ts): `DevframeCommandsHost.register()` returns a `update` callable that throws when `'id' in patch`.


## Sitemap

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