gatsbyjs/gatsby · error

Error fetching tags: ${createContentfulErrorMessage(e)}

Error message

Error fetching tags: ${createContentfulErrorMessage(e)}

What it means

In fetchContent, when enableTags is set, fetching tags via the non-sync paged API threw. The catch converts it to a structured reporter.panic with the FetchTags error code; the raw SDK error is embedded via createContentfulErrorMessage.

Source

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

      !currentSyncData?.deletedEntries.length &&
      !currentSyncData?.deletedAssets.length
    ) {
      syncProgress.tick()
      syncProgress.total = 1
    }

    syncProgress.done()
  }

  // We need to fetch tags with the non-sync API as the sync API doesn't support this.
  let tagItems = []
  if (pluginConfig.get(`enableTags`)) {
    try {
      const tagsResult = await pagedGet(client, `getTags`, pageLimit)
      tagItems = tagsResult.items
      reporter.verbose(`Tags fetched ${tagItems.length}`)
    } catch (e) {
      reporter.panic({
        id: CODES.FetchTags,
        context: {
          sourceMessage: `Error fetching tags: ${createContentfulErrorMessage(
            e
          )}`,
        },
      })
    }
  }

  const result = {
    currentSyncData,
    tagItems,
    defaultLocale,
    locales,
    space,
  }

View on GitHub (pinned to e85d62f177)

Solutions

  1. Verify API credentials can read tags
  2. Retry the build (transient Contentful API failures)
  3. Disable enableTags if tags are not needed
Defensive patterns

Strategy: try-catch

When it happens

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