gatsbyjs/gatsby · error

The sync with Contentful failed using pageLimit ${lastCurren

Error message

The sync with Contentful failed using pageLimit ${lastCurrentPageLimit} as the reponse size limit of the API is exceeded.

Retrying sync with pageLimit of ${currentPageLimit}

What it means

Error "The sync with Contentful failed using pageLimit ${lastCurrentPageLimit} as the reponse size limit of the API is exceeded. Retrying sync with pageLimit of ${currentPageLimit}" thrown in gatsbyjs/gatsby.

Source

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

  try {
    while (!syncSuccess) {
      try {
        const query = syncToken
          ? { nextSyncToken: syncToken }
          : { initial: true, limit: currentPageLimit }
        currentSyncData = await syncClient.sync(query)
        syncSuccess = true
      } catch (e) {
        // Back off page limit if responses content length exceeds Contentfuls limits.
        if (
          e.response?.data?.message.includes(`Response size too big`) &&
          currentPageLimit > 1
        ) {
          lastCurrentPageLimit = currentPageLimit
          // Reduce page limit by a arbitrary 1/3 of the current limit to ensure
          // the new and bigger entries are synced without exceeding the reponse size limit
          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,

View on GitHub (pinned to e85d62f177)

Solutions

  1. No action needed: the sync automatically retries with a smaller pageLimit
  2. Optionally configure a lower pageLimit in the plugin options to avoid oversized API responses
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at packages/gatsby-source-contentful/src/fetch.js:306 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/61e3dea6b3428163. Report an issue: GitHub.