gatsbyjs/gatsby · error

Accessing your Contentful space failed: ${createContentfulEr

Error message

Accessing your Contentful space failed: ${createContentfulErrorMessage(e)}

Try setting GATSBY_CONTENTFUL_OFFLINE=true to see if we can serve from cache.
${details ? `\n${details}\n` : ``}
Used options:
${formatPluginOptionsForCLI(pluginConfig.getOriginalPluginOptions(), errors)}

What it means

Error "Accessing your Contentful space failed: ${createContentfulErrorMessage(e)} Try setting GATSBY_CONTENTFUL_OFFLINE=true to see if we can serve from cache. ${details ? `\n${details}\n` : ``} Used options: ${formatPluginOptionsForCLI(pluginConfig.getOriginalPluginOptions(), errors)}" thrown in gatsbyjs/gatsby.

Source

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

        `host`
      )} and ${chalk.yellow(`spaceId`)} settings are correct`
      errors = {
        host: `Check if setting is correct`,
        spaceId: `Check if setting is correct`,
      }
    } else if (e.responseData.status === 401) {
      // authorization error
      details = `Authorization error. Check if ${chalk.yellow(
        `accessToken`
      )} and ${chalk.yellow(`environment`)} are correct`
      errors = {
        accessToken: `Check if setting is correct`,
        environment: `Check if setting is correct`,
      }
    }
  }

  reporter.panic({
    context: {
      sourceMessage: `Accessing your Contentful space failed: ${createContentfulErrorMessage(
        e
      )}

Try setting GATSBY_CONTENTFUL_OFFLINE=true to see if we can serve from cache.
${details ? `\n${details}\n` : ``}
Used options:
${formatPluginOptionsForCLI(pluginConfig.getOriginalPluginOptions(), errors)}`,
    },
  })
}

/**
 * Fetches:
 * * Locales with default locale
 * * Entries and assets
 * * Tags

View on GitHub (pinned to 8b06340921)

Solutions

  1. Double check the spaceId, accessToken, and environment options in gatsby-config.js match your Contentful space settings.
  2. Verify the access token has permission to read the target environment.
  3. Set GATSBY_CONTENTFUL_OFFLINE=true to serve from cache while debugging.

When it happens

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

Common situations: Occurs when the initial Contentful space access request fails (wrong spaceId, accessToken, environment, or network). Double-check credentials in gatsby-config.js and the environment name; try GATSBY_CONTENTFUL_OFFLINE=true to build from cache.


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