gatsbyjs/gatsby · error

111001

111001

Error message

${e.message}\n\n${errorContext}\n\nThis can happen due to custom code or redirection plugins which redirect the request when a post is accessed.\nThis redirection code will need to be patched to not run during GraphQL requests.

What it means

Error "${e.message}\n\n${errorContext}\n\nThis can happen due to custom code or redirection plugins which redirect the request when a post is accessed.\nThis redirection code will need to be patched to not run during GraphQL requests." thrown in gatsbyjs/gatsby.

Source

Thrown at packages/gatsby-source-wordpress/src/utils/fetch-graphql.ts:467

  if (forbidden) {
    reporter.panic({
      id: CODES.RequestDenied,
      context: {
        sourceMessage: formatLogMessage(
          `${e.message}\n\nThe GraphQL request was forbidden.\nIf you are using a security plugin like WordFence or a server firewall you may need to add your IP address to the allow list or adjust your firewall settings for your GraphQL endpoint.\n\n${errorContext}`
        ),
      },
    })

    return
  }

  const redirected = e.message.includes(`GraphQL request was redirected`)

  if (redirected) {
    await handleErrorOptions({ variables, query, pluginOptions, reporter })
    reporter.panic({
      id: CODES.WordPressFilters,
      context: {
        sourceMessage: formatLogMessage(
          `${e.message}\n\n${errorContext}\n\nThis can happen due to custom code or redirection plugins which redirect the request when a post is accessed.\nThis redirection code will need to be patched to not run during GraphQL requests.\n\nThat can be achieved by adding something like the following to your WP PHP code:\n
if ( defined( 'GRAPHQL_REQUEST' ) && true === GRAPHQL_REQUEST ) {
  return examplePreventRedirect();
}

${slackChannelSupportMessage}`
        ),
      },
    })

    return
  }

  const responseReturnedHtml =
    !!response?.headers[`content-type`].includes(`text/html;`)

View on GitHub (pinned to 8b06340921)

Solutions

  1. Find the custom code or redirection plugin that redirects the request and patch it to not run during GraphQL requests.
  2. Guard redirects with a check for the GraphQL endpoint path or the WPGraphQL request context.

When it happens

Trigger: Thrown at packages/gatsby-source-wordpress/src/utils/fetch-graphql.ts:467 when the library encounters an invalid state.

Common situations: Occurs when a WordPress redirect plugin or custom code redirects GraphQL requests. Patch the redirection logic so it does not run for GraphQL requests.


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