gatsbyjs/gatsby · error

Encountered an error parsing the provided GraphQL type…

Error message

Encountered an error parsing the provided GraphQL type definitions:
${message}

${frame}

What it means

Fires from reportParsingError when SDL passed to createTypes fails GraphQL parsing: the panic includes the parser message and a code frame (5 lines above/below) around the first offending location in the type definition string.

Solutions

  1. Correct the invalid GraphQL SDL syntax at the flagged location in the type definitions passed to createTypes
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at packages/gatsby/src/schema/types/type-defs.js:37 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/33a01dc3c265d7f6. Report an issue: GitHub.

Appendix: source

Thrown at packages/gatsby/src/schema/types/type-defs.js:37

    } catch (error) {
      reportParsingError(error)
    }
  }
  return typeOrTypeDef
}

const reportParsingError = error => {
  const { message, source, locations } = error

  if (source && locations && locations.length) {
    const { codeFrameColumns } = require(`@babel/code-frame`)

    const frame = codeFrameColumns(
      source.body,
      { start: locations[0] },
      { linesAbove: 5, linesBelow: 5 }
    )
    report.panic(
      `Encountered an error parsing the provided GraphQL type definitions:\n` +
        message +
        `\n\n` +
        frame +
        `\n`
    )
  } else {
    throw error
  }
}

/**
 * Given a type definition, collects type names that should skip the inference process
 */
const typesWithoutInference = (typeNames = [], typeOrTypeDef) => {
  if (typeof typeOrTypeDef === `string`) {
    typeOrTypeDef = parseTypeDef(typeOrTypeDef)
  }

View on GitHub (pinned to e85d62f177)