{"record":{"id":"7ca68b841970e848","repo":"gatsbyjs/gatsby","slug":"fragment-spread-name-value-does-not-exist","errorCode":null,"errorMessage":"Fragment ${spread.name.value} does not exist","messagePattern":"Fragment (.+?) does not exist","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/gatsby-source-graphql/src/batching/merge-queries.js","lineNumber":306,"sourceCode":"\n/**\n * Replaces fragment spread with inline fragment\n *\n * Example:\n *   query { ...Spread }\n *   fragment Spread on Query { bar }\n *\n * Transforms to:\n *   query { ... on Query { bar } }\n */\nfunction inlineFragmentSpread(spread, document) {\n  const fragment = document.definitions.find(\n    def =>\n      def.kind === Kind.FRAGMENT_DEFINITION &&\n      def.name.value === spread.name.value\n  )\n  if (!fragment) {\n    throw new Error(`Fragment ${spread.name.value} does not exist`)\n  }\n  const { typeCondition, selectionSet } = fragment\n  return {\n    kind: Kind.INLINE_FRAGMENT,\n    typeCondition,\n    selectionSet,\n    directives: spread.directives,\n  }\n}\n\nfunction prefixNodeName(namedNode, prefix) {\n  return {\n    ...namedNode,\n    name: {\n      ...namedNode.name,\n      value: prefix + namedNode.name.value,\n    },\n  }","sourceCodeStart":288,"sourceCodeEnd":324,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/e85d62f1779e353eaac1753211629a26d123e26c/packages/gatsby-source-graphql/src/batching/merge-queries.js#L288-L324","documentation":"inlineFragmentSpread looks up the fragment definition referenced by a spread node in the document being merged; not finding it means the query uses a fragment spread that was not included when assembling the batched/merged document — an internal invariant of query batching, usually a fragment-collection bug rather than user error.","triggerScenarios":"Thrown at packages/gatsby-source-graphql/src/batching/merge-queries.js:306 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure all referenced fragments are included in the same GraphQL document","Check that fragment names in spreads exactly match defined fragment names","Avoid manually stripping fragment definitions from documents passed to batching"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e85d62f1779e353eaac1753211629a26d123e26c","analyzedAt":"2026-08-26T17:50:09.662Z","contentChangedAt":"2026-08-26T17:50:09.662Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}