{"record":{"id":"088646e3a7d0d1a2","repo":"facebook/relay","slug":"unexpected-selection-type-selection-kind","errorCode":null,"errorMessage":"Unexpected selection type: ${selection.kind}","messagePattern":"Unexpected selection type: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/relay-runtime/store/RelayExperimentalGraphResponseTransform.js","lineNumber":411,"sourceCode":"          }\n          break;\n        case CLIENT_EXTENSION:\n          // Since we are only expecting to handle server responses, we can skip\n          // over client extensions.\n          break;\n        case SCALAR_HANDLE:\n        case LINKED_HANDLE:\n          // Handles allow us to record information that will be needed to\n          // perform additional process when we insert data into the store. For\n          // example, connection edges need to be prepended/appended to the\n          // pre-existing values.\n          //\n          // GraphMode will eventually need some replacement for this, but it is\n          // not nessesary in order to measure things like response size, so we\n          // can ignore these for now.\n          break;\n        default:\n          throw new Error(`Unexpected selection type: ${selection.kind}`);\n      }\n    }\n  }\n\n  *_traverseLinkedField(\n    plural: boolean,\n    fieldData: PayloadData,\n    storageKey: string,\n    selection: NormalizationLinkedField,\n    parentID: string,\n    index?: number,\n  ): Generator<GraphModeChunk, ChunkField, void> {\n    if (fieldData == null) {\n      return null;\n    }\n\n    if (plural) {\n      invariant(","sourceCodeStart":393,"sourceCodeEnd":429,"githubUrl":"https://github.com/facebook/relay/blob/668b1b85e06261aa3b58dabfc51f8b5524a70955/packages/relay-runtime/store/RelayExperimentalGraphResponseTransform.js#L393-L429","documentation":"The GraphMode response transformer walks selections of the query AST to measure/transform a server response. When it encounters a selection kind it has no case for, it throws because silently skipping could produce incorrect measurements/results.","triggerScenarios":"Running GraphMode experimental transforms over a query containing a selection kind not handled by _traverseSelection (e.g. newer Relay AST node kinds like ClientExtension or newer language features added after the transformer was written).","commonSituations":"Using the experimental GraphMode utilities with queries that use Relay directives/features they don't support yet; upgrading Relay (new AST kinds) without updating experimental transformers; hand-written ASTs.","solutions":["Simplify/adjust the query to avoid selection kinds unsupported by GraphMode","Disable GraphMode/experimental response transforms and use the standard normalization path","Check whether a newer relay version adds handling for that selection kind and upgrade","File/inspect a Relay issue for the specific selection.kind value emitted"],"exampleFix":"// before\n// experimental GraphMode transform over query containing unhandled selection kind\napplyTransform(env, query, response);\n// after\n// use the default (non-GraphMode) execute path\nenvironment.execute({operation});","handlingStrategy":"try-catch","validationCode":"null","typeGuard":"null","tryCatchPattern":"try {\n  applyGraphModeTransform(query, response);\n} catch (e) {\n  if (String(e.message).startsWith('Unexpected selection type')) {\n    console.error('GraphMode cannot handle this query; using default pipeline');\n    return environment.execute({operation});\n  }\n  throw e;\n}","preventionTips":["Only use GraphMode transforms with queries known to be supported","Pin/align relay versions when using experimental APIs","Avoid hand-built GraphQLTaggedNode ASTs","Test experimental transforms across your query corpus"],"tags":["relay","graphql","experimental","unsupported-feature"],"backgroundTag":"unsupported-node-kind","analyzedSha":"668b1b85e06261aa3b58dabfc51f8b5524a70955","analyzedAt":"2026-09-02T19:57:20.783Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}