{"record":{"id":"c5d4d4ea6fe2d8dc","repo":"Kong/insomnia","slug":"found-usage-of-unknown-fragment-selection-name-v","errorCode":null,"errorMessage":"Found usage of unknown fragment ${selection.name.value}","messagePattern":"Found usage of unknown fragment (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/insomnia/src/ui/components/editors/body/prettify-graphql.mjs","lineNumber":99,"sourceCode":"const replaceFragments = (sourceNode, fragments) => {\n  if (isSelectionsEmpty(sourceNode)) {\n    return sourceNode;\n  }\n\n  const newNode = { ...sourceNode };\n\n  let foundFragments = [];\n\n  newNode.selectionSet.selections = newNode.selectionSet.selections.filter(selection => {\n    if (selection.kind !== Kind.FRAGMENT_SPREAD) {\n      return true;\n    }\n\n    if (!foundFragments.find(fragment => fragment.name.value === selection.name.value)) {\n      const fragment = fragments.find(fragment => fragment.name.value === selection.name.value);\n\n      if (!fragment) {\n        throw new Error(`Found usage of unknown fragment ${selection.name.value}`);\n      }\n\n      foundFragments = [...foundFragments, fragment];\n    }\n\n    return false;\n  });\n\n  newNode.selectionSet.selections = [\n    ...newNode.selectionSet.selections,\n    ...foundFragments.reduce((acc, fragment) => [...fragment.selectionSet.selections, ...acc], []),\n  ];\n\n  newNode.selectionSet.selections = newNode.selectionSet.selections.map(selection =>\n    replaceFragments(selection, fragments),\n  );\n\n  return newNode;","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/Kong/insomnia/blob/d9bb2b0142600f21309832daea3317942d285984/packages/insomnia/src/ui/components/editors/body/prettify-graphql.mjs#L81-L117","documentation":"Error \"Found usage of unknown fragment ${selection.name.value}\" thrown in Kong/insomnia.","triggerScenarios":"Thrown at packages/insomnia/src/ui/components/editors/body/prettify-graphql.mjs:99 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"d9bb2b0142600f21309832daea3317942d285984","analyzedAt":"2026-08-26T18:04:05.187Z","schemaVersion":2},"datasetVersion":"2026-08-26T21:11:00.512Z"}