gatsbyjs/gatsby · error

111003

111003

Error message

Fetching contentful data failed: ${createContentfulErrorMessage(e)}

What it means

handleContentfulError rethrows a fatal panic after the Contentful SDK's fetch of sync data fails. The message wraps the SDK error plus actionable context: suggests GATSBY_CONTENTFUL_OFFLINE=true to serve from cache and echoes the resolved plugin options used, so credential/endpoint problems can be spotted.

Source

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

          currentPageLimit = Math.floor((currentPageLimit / 3) * 2) || 1
          reporter.warn(
            [
              `The sync with Contentful failed using pageLimit ${lastCurrentPageLimit} as the reponse size limit of the API is exceeded.`,
              `Retrying sync with pageLimit of ${currentPageLimit}`,
            ].join(`\n\n`)
          )
          continue
        }
        throw e
      }
      if (currentPageLimit !== pageLimit) {
        reporter.warn(
          `We recommend you to set your pageLimit in gatsby-config.js to ${currentPageLimit} to avoid failed synchronizations.`
        )
      }
    }
  } catch (e) {
    reporter.panic({
      id: CODES.SyncError,
      context: {
        sourceMessage: `Fetching contentful data failed: ${createContentfulErrorMessage(
          e
        )}`,
      },
    })
  } finally {
    // Fix output when there was no new data in Contentful
    if (
      !currentSyncData?.entries.length &&
      !currentSyncData?.assets.length &&
      !currentSyncData?.deletedEntries.length &&
      !currentSyncData?.deletedAssets.length
    ) {
      syncProgress.tick()
      syncProgress.total = 1
    }

View on GitHub (pinned to e85d62f177)

Solutions

  1. Check spaceId, accessToken, environment and host options
  2. Set GATSBY_CONTENTFUL_OFFLINE=true to serve from cache while offline
  3. Fix network/SDK issue shown in createContentfulErrorMessage details
Defensive patterns

Strategy: fallback

When it happens

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

Common situations: See trigger scenarios.


AI-assisted analysis of gatsbyjs/gatsby@e85d62f177 (2026-08-26). Data as JSON: /api/errors/b266ee60846cac5d. Report an issue: GitHub.