gatsbyjs/gatsby · error

FetchContentTypes

FetchContentTypes

Error message

Error fetching content types: ${createContentfulErrorMessage(e)}

What it means

Error "Error fetching content types: ${createContentfulErrorMessage(e)}" thrown in gatsbyjs/gatsby.

Source

Thrown at packages/gatsby-source-contentful/src/fetch.js:399

  const contentfulClientOptions = createContentfulClientOptions({
    pluginConfig,
    reporter,
  })
  const client = createClient(contentfulClientOptions)
  const pageLimit = pluginConfig.get(`pageLimit`)
  const sourceId = `${pluginConfig.get(`spaceId`)}-${pluginConfig.get(
    `environment`
  )}`
  let contentTypes = null

  try {
    reporter.verbose(`Fetching content types (${sourceId})`)

    // Fetch content types from CDA API
    try {
      contentTypes = await pagedGet(client, `getContentTypes`, pageLimit)
    } catch (e) {
      reporter.panic({
        id: CODES.FetchContentTypes,
        context: {
          sourceMessage: `Error fetching content types: ${createContentfulErrorMessage(
            e
          )}`,
        },
      })
    }
    reporter.verbose(
      `Content types fetched ${contentTypes.items.length} (${sourceId})`
    )

    contentTypes = contentTypes.items
  } catch (e) {
    handleContentfulError(e)
  }

  return contentTypes

View on GitHub (pinned to 8b06340921)

Solutions

  1. Verify the Contentful access token can read content types in the configured environment.
  2. Check the space ID and environment options, then retry the build.

When it happens

Trigger: Thrown at packages/gatsby-source-contentful/src/fetch.js:399 when the library encounters an invalid state.

Common situations: Occurs when fetching content types from Contentful fails. Verify spaceId/accessToken/environment in plugin options and network access to the Contentful API.


AI-assisted analysis of gatsbyjs/gatsby@8b06340921 (2026-08-13). Data as JSON: /api/errors/73418d354e5c018c. Report an issue: GitHub.