# SUBREGISTRY_EXISTS

> For the complete documentation index, see [llms.txt](https://ensforge.com/llms.txt).

What SUBREGISTRY_EXISTS means, why NameStateError throws it, what to show users and how to fix it in ensforge. Also covers retry safety.

Source: https://ensforge.com/docs/reference/errors/SUBREGISTRY_EXISTS

<ErrorMeta errorClass="NameStateError" href="/docs/reference/errors/name-state-error" package="@ensforge/sdk" />

## What happened [#what-happened]

The name already has a subregistry; replacing it orphans every subname in it.

## What to show users [#what-to-show-users]

| Title | Message | Action |
| --- | --- | --- |
| Subnames in place | This name already holds subnames that replacing its registry would remove. |  |

## How to fix [#how-to-fix]

Pass `replace: true` to replace it anyway.

## Retry safety [#retry-safety]

Retrying the same call fails the same way until the cause is fixed (`retryable: false`).

## Actions that throw it [#actions-that-throw-it]

| Action | When |
| --- | --- |
| [`registry.attach`](/docs/reference/sdk/registry/attach) | when the name already has another subregistry and `replace` is not set. |
| [`registry.deploy`](/docs/reference/sdk/registry/deploy) | when `attachTo` already has a subregistry and `replace` is not set. |

## Catch it [#catch-it]

`Errors.hasCode("SUBREGISTRY_EXISTS")` narrows to this error. See [Handle errors](/docs/sdk/handle-errors).