{"record":{"id":"f7275d51cfcb2089","repo":"gatsbyjs/gatsby","slug":"interfaces-with-the-nodeinterface-extension-must","errorCode":null,"errorMessage":"Interfaces with the `nodeInterface` extension must have a field `id` of type `ID!`. Check the type definition of `${typeComposer.getTypeName()}`.","messagePattern":"Interfaces with the `nodeInterface` extension must have a field `id` of type `ID!`\\. Check the type definition of `(.+?)`\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"packages/gatsby/src/schema/schema.js","lineNumber":515,"sourceCode":"  typeComposer,\n  extensions = {},\n  plugin,\n  createdFrom,\n}) => {\n  typeComposer.setExtension(`createdFrom`, createdFrom)\n  typeComposer.setExtension(`plugin`, plugin ? plugin.name : null)\n  typeComposer.extendExtensions(extensions)\n\n  if (\n    typeComposer instanceof InterfaceTypeComposer &&\n    isNodeInterface(typeComposer)\n  ) {\n    const hasCorrectIdField =\n      typeComposer.hasField(`id`) &&\n      typeComposer.getFieldType(`id`).toString() === `ID!`\n\n    if (!hasCorrectIdField) {\n      report.panic(\n        `Interfaces with the \\`nodeInterface\\` extension must have a field ` +\n          `\\`id\\` of type \\`ID!\\`. Check the type definition of ` +\n          `\\`${typeComposer.getTypeName()}\\`.`\n      )\n    }\n  }\n\n  if (\n    typeComposer instanceof ObjectTypeComposer ||\n    typeComposer instanceof InterfaceTypeComposer ||\n    typeComposer instanceof InputTypeComposer\n  ) {\n    typeComposer.getFieldNames().forEach(fieldName => {\n      typeComposer.setFieldExtension(fieldName, `createdFrom`, createdFrom)\n      typeComposer.setFieldExtension(\n        fieldName,\n        `plugin`,\n        plugin ? plugin.name : null","sourceCodeStart":497,"sourceCodeEnd":533,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/8b06340921ffdf23125a365b9c9923690cb62ce6/packages/gatsby/src/schema/schema.js#L497-L533","documentation":"When a GraphQL interface type has the nodeInterface extension set, Gatsby requires it to declare a field named `id` of type `ID!` (non-null ID). This is the contract that allows the interface to participate in Gatsby's global node identification system. The panic fires when hasField('id') is false or the field type is not exactly ID!.","triggerScenarios":"Defining an interface type with the @nodeInterface extension (or programmatically setting the nodeInterface extension) that either omits the id field, makes it nullable (ID), or names the field something other than id.","commonSituations":"A plugin or gatsby-node.js uses createTypes with `interface NodeInterface @nodeInterface { ... }` but forgets the `id: ID!` field. Or the id field is declared as ID (nullable) instead of ID!.","solutions":["Add `id: ID!` to the interface type definition that has the @nodeInterface extension.","If the field exists, ensure its type is exactly ID! not ID -- change nullable to non-null.","If you did not intend this interface to be a node interface, remove the @nodeInterface extension / nodeInterface extension setting."],"exampleFix":"// before\ninterface MyInterface @nodeInterface {\n  name: String\n}\n\n// after\ninterface MyInterface @nodeInterface {\n  id: ID!\n  name: String\n}","handlingStrategy":"validation","validationCode":"// Validate node interface has id: ID!\nfunction validateNodeInterface(typeDef) {\n  if (!/@nodeInterface/.test(typeDef)) return true\n  const hasIdField = /\\bid\\s*:\\s*ID!/.test(typeDef)\n  return hasIdField\n}\n\nif (!validateNodeInterface(myTypeDef)) {\n  throw new Error('nodeInterface types must have id: ID!')\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always include id: ID! when using the @nodeInterface extension.","Double-check the field is non-null (ID!) not nullable (ID).","Remove @nodeInterface if the interface is not meant to be a node."],"tags":["graphql","schema","node-interface","type-definition"],"backgroundTag":null,"analyzedSha":"8b06340921ffdf23125a365b9c9923690cb62ce6","analyzedAt":"2026-08-13T02:36:21.405Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}