---
title: "X18N4002: Rename target already exists"
description: "Rename target already exists. Delete or rename the existing key first."
canonical_url: "https://x18n.dev/errors/x18n4002"
---
# X18N4002: Rename target already exists

> Rename target already exists. Delete or rename the existing key first.

<!-- Generated by docs/scripts/generate.ts from the source code. Do not edit. -->

## Message

```
[X18N4002] Rename target already exists <detail>
├▶ fix: Delete or rename the existing key first.
╰▶ see: https://x18n.dev/errors/x18n4002
```

The CLI prints the code and why the error happened, with details such as a file name or a field. The fix and a link to this page follow. With `--json`, the same parts are in `errors` of the [envelope](https://x18n.dev/references/json-contracts).

## What to do

A rename target already exists in at least one locale. x18n does not merge two keys.

1. Run `x18n get <to>` to see the existing key.
2. Delete or rename it first, then run the rename again.

## Exit code

The CLI exits with code `1`.

## Source

- [`packages/core/src/project/planner.ts`](https://github.com/x18n-dev/x18n/blob/main/packages/core/src/project/planner.ts)


## Sitemap

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