gatsbyjs/gatsby · error
FetchContentTypes
FetchContentTypes
Error message
Restricted ContentType name found. The name "${contentTypeItemId}" is not allowed. What it means
Error "Restricted ContentType name found. The name "${contentTypeItemId}" is not allowed." thrown in gatsbyjs/gatsby.
Source
Thrown at packages/gatsby-source-contentful/src/create-schema-customization.js:54
// Check for restricted content type names and set id based on useNameForId
const useNameForId = pluginConfig.get(`useNameForId`)
const restrictedContentTypes = [`entity`, `reference`, `asset`]
if (pluginConfig.get(`enableTags`)) {
restrictedContentTypes.push(`tag`)
}
contentTypeItems.forEach(contentTypeItem => {
// Establish identifier for content type
// Use `name` if specified, otherwise, use internal id (usually a natural-language constant,
// but sometimes a base62 uuid generated by Contentful, hence the option)
let contentTypeItemId = contentTypeItem.sys.id
if (useNameForId) {
contentTypeItemId = contentTypeItem.name.toLowerCase()
}
if (restrictedContentTypes.includes(contentTypeItemId)) {
reporter.panic({
id: CODES.FetchContentTypes,
context: {
sourceMessage: `Restricted ContentType name found. The name "${contentTypeItemId}" is not allowed.`,
},
})
}
})
// Store processed content types in cache for sourceNodes
const sourceId = `${pluginConfig.get(`spaceId`)}-${pluginConfig.get(
`environment`
)}`
const CACHE_CONTENT_TYPES = `contentful-content-types-${sourceId}`
await cache.set(CACHE_CONTENT_TYPES, contentTypeItems)
return contentTypeItems
}
View on GitHub (pinned to 8b06340921)
Solutions
- Rename the Contentful content type to avoid restricted names (names that collide with Gatsby internal types such as Node or names starting with reserved prefixes).
- Create a new content type in Contentful with an allowed name and migrate the entries.
When it happens
Trigger: Thrown at packages/gatsby-source-contentful/src/create-schema-customization.js:54 when the library encounters an invalid state.
Common situations: Occurs when a Contentful content type uses a reserved/restricted name (e.g. 'ContentType'). Rename the content type in Contentful to avoid restricted identifiers.
AI-assisted analysis of gatsbyjs/gatsby@8b06340921 (2026-08-13).
Data as JSON: /api/errors/1b1744ddc10e6a75.
Report an issue: GitHub.