gatsbyjs/gatsby · critical

Building schema failed

Error message

Building schema failed

What it means

Gatsby panics during schema inference when one or more types declared via createTypes look like node types (i.e. they would normally be inferred as nodes) but do not implement the Node interface. The preceding warning messages list each offending type name and suggest adding `implements Node` or `@dontInfer`. This is a hard schema-construction failure.

Source

Thrown at packages/gatsby/src/schema/infer/index.js:61

      typeComposer.setExtension(`createdFrom`, `inference`)
      typesToInfer.push(typeComposer)
    }
  })

  if (noNodeInterfaceTypes.length > 0) {
    noNodeInterfaceTypes.forEach(typeName => {
      report.warn(
        `Type \`${typeName}\` declared in \`createTypes\` looks like a node, ` +
          `but doesn't implement a \`Node\` interface. It's likely that you should ` +
          `add the \`Node\` interface to your type def:\n\n` +
          `\`type ${typeName} implements Node { ... }\`\n\n` +
          `If you know that you don't want it to be a node (which would mean no ` +
          `root queries to retrieve it), you can explicitly disable inference ` +
          `for it:\n\n` +
          `\`type ${typeName} @dontInfer { ... }\``
      )
    })
    report.panic(`Building schema failed`)
  }

  return typesToInfer.map(typeComposer =>
    addInferredType({
      schemaComposer,
      typeComposer,
      typeConflictReporter,
      typeMapping,
      parentSpan,
      inferenceMetadata,
    })
  )
}

const addInferredType = ({
  schemaComposer,
  typeComposer,
  typeConflictReporter,

View on GitHub (pinned to 8b06340921)

Solutions

  1. Add `implements Node` to each type listed in the preceding warning: `type MyType implements Node { ... }`.
  2. If the type is intentionally not a node, add the `@dontInfer` directive: `type MyType @dontInfer { ... }`.
  3. Search your codebase and all plugins for createTypes calls referencing the listed type names and correct the definitions.

Example fix

// before
type MyType {
  title: String
}

// after
type MyType implements Node {
  title: String
}

// or, if not a node:
type MyType @dontInfer {
  title: String
}
Defensive patterns

Strategy: validation

Validate before calling

// Validate type defs before passing to createTypes
const { parse } = require('graphql')
const typeDefs = `
  type MyType {
    title: String
  }
`
// Check: if type looks like a node, it must implement Node
const looksLikeNode = /type\s+\w+\s*\{/.test(typeDefs)
const implementsNode = /implements\s+.*Node/.test(typeDefs)
const hasDontInfer = /@dontInfer/.test(typeDefs)
if (looksLikeNode && !implementsNode && !hasDontInfer) {
  console.warn('Type may need implements Node or @dontInfer')
}

Prevention

When it happens

Trigger: Calling actions.createTypes with a type like `type MyType { title: String }` where Gatsby's inference heuristics detect the type should be a node, but the type definition omits `implements Node`. The noNodeInterfaceTypes array is populated upstream when inferred types lack the Node interface.

Common situations: A plugin or gatsby-node.js defines a custom type via createTypes that resembles a node (fields like id, common node shapes) without `implements Node`. Migrating from older Gatsby versions where this was silently tolerated. Copy-pasting a type definition from docs that omitted the interface.

Related errors


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