strapi/strapi · error · Error

Content-type ${uid} has already been registered.

Error message

Content-type ${uid} has already been registered.

What it means

Thrown by the content-types Registry's `add` method when a UID (namespace + key) is already in the registry. Content-type UIDs must be unique across the whole app (e.g. 'api::article.article'); a duplicate means two sources contribute the same UID.

Source

Thrown at packages/core/core/src/registries/content-types.ts:64

    /**
     * Registers a contentType
     */
    set(uid: UID.ContentType, contentType: Struct.ContentTypeSchema) {
      contentTypes[uid] = contentType;
      return this;
    },

    /**
     * Registers a map of contentTypes for a specific namespace
     */
    add(namespace: string, newContentTypes: ContentTypesInput) {
      validateKeySameToSingularName(newContentTypes);

      for (const rawCtName of Object.keys(newContentTypes)) {
        const uid = addNamespace(rawCtName, namespace);

        if (has(uid, contentTypes)) {
          throw new Error(`Content-type ${uid} has already been registered.`);
        }

        contentTypes[uid] = createContentType(uid, newContentTypes[rawCtName]);
      }
    },

    /**
     * Wraps a contentType to extend it
     */
    extend(ctUID: UID.ContentType, extendFn: ContentTypeExtendFn) {
      const currentContentType = this.get(ctUID);

      if (!currentContentType) {
        throw new Error(`Content-Type ${ctUID} doesn't exist`);
      }

      extendFn(currentContentType);

View on GitHub (pinned to 4a4101264d)

Solutions

  1. Search for the duplicate UID across src/api and packages/plugins/*/server/src/content-types.
  2. Rename one of the colliding content-types (folder + singularName).
  3. Remove stale content-type folders from a previous rename.
  4. Restart after clearing the dist/.cache build output.
Defensive patterns

Strategy: validation

Validate before calling

function safeAddContentType(strapi, namespace, map) {
  const existing = Object.keys(strapi.contentTypes);
  for (const key of Object.keys(map)) {
    const uid = `${namespace}::${key}.${key}`;
    if (existing.includes(uid)) {
      throw new Error(`Duplicate content-type UID detected: ${uid}`);
    }
  }
  strapi.container.get('content-types').add(namespace, map);
}

Prevention

When it happens

Trigger: Two content-type definitions resolve to the same namespaced UID; a plugin and the app both declare 'api::foo.foo'; calling add() twice with the same namespace/key.

Common situations: Two API folders with the same content-type name; plugin content-type colliding with an app content-type; duplicate scaffolding; stale build artifacts re-registering.

Related errors


AI-assisted analysis of strapi/strapi@4a4101264d (2026-08-12). Data as JSON: /api/errors/4e7bdcaa25cb03a5. Report an issue: GitHub.