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
- Search for the duplicate UID across src/api and packages/plugins/*/server/src/content-types.
- Rename one of the colliding content-types (folder + singularName).
- Remove stale content-type folders from a previous rename.
- 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
- Keep content-type folder names unique across api/ and plugins/.
- Clear .cache and dist when renaming to avoid stale double-registration.
- CI: assert no two schema.json files share the same namespaced UID.
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
- API ${apiName} has already been registered.
- Component ${uid} has already been registered.
- The key of the content-type should be the same as its singul
- Controller ${uid} has already been registered.
- Content-Type ${ctUID} doesn't exist
AI-assisted analysis of strapi/strapi@4a4101264d (2026-08-12).
Data as JSON: /api/errors/4e7bdcaa25cb03a5.
Report an issue: GitHub.