{"record":{"id":"30679067b378700a","repo":"gatsbyjs/gatsby","slug":"can-t-determine-type-for-value-in-selecto","errorCode":null,"errorMessage":"Can't determine type for \"${value}\" in \\`${selector}\\`.","messagePattern":"Can't determine type for \"(.+?)\" in \\\\`(.+?)\\\\`\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/gatsby/src/schema/infer/add-inferred-fields.js","lineNumber":381,"sourceCode":"        const inferenceConfig = getInferenceConfig({\n          typeComposer: fieldTypeComposer,\n          defaults: config,\n        })\n\n        return {\n          type: addInferredFieldsImpl({\n            schemaComposer,\n            typeComposer: fieldTypeComposer,\n            exampleObject: value,\n            typeMapping,\n            prefix: selector,\n            unsanitizedFieldPath,\n            config: inferenceConfig,\n          }),\n        }\n      }\n  }\n  throw new Error(`Can't determine type for \"${value}\" in \\`${selector}\\`.`)\n}\n\nconst createTypeName = selector => {\n  const keys = selector.split(`.`)\n  const suffix = keys.slice(1).map(_.upperFirst).join(``)\n  return `${keys[0]}${suffix}`\n}\n\nconst NON_ALPHA_NUMERIC_EXPR = new RegExp(`[^a-zA-Z0-9_]`, `g`)\n\n/**\n * GraphQL field names must be a string and cannot contain anything other than\n * alphanumeric characters and `_`. They also can't start with `__` which is\n * reserved for internal fields (`___foo` doesn't work either).\n */\nconst createFieldName = key => {\n  // Check if the key is really a string otherwise GraphQL will throw.\n  invariant(","sourceCodeStart":363,"sourceCodeEnd":399,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/8b06340921ffdf23125a365b9c9923690cb62ce6/packages/gatsby/src/schema/infer/add-inferred-fields.js#L363-L399","documentation":"Gatsby infers a GraphQL field type from the first observed (\"example\") value of each node field. getSimpleFieldConfig switches on typeof value to map to Boolean/Int/Float/String/Date/File or a nested object type. When the example value does not match any supported branch (e.g. it is null, undefined, a Symbol, a BigInt, or a Function), no type can be assigned and Gatsby throws with the offending value and the dotted selector path.","triggerScenarios":"A source node field whose very first encountered value is null/undefined/BigInt/Symbol/function; an array field whose first element is null; a custom plugin emitting an opaque object that isn't a plain Object/Date/String; the @dontInfer path returning null so no composer is built and execution falls through to the throw.","commonSituations":"Source plugin records where a field happens to be null in the first row; a plugin returning BigInt ids after a Node.js upgrade; inconsistent data shapes across nodes; moving to a stricter Gatsby inference version.","solutions":["Make the first-observed value of the field a concrete scalar/object (reorder records or backfill a placeholder).","Declare the field type explicitly via createTypes schema customization so inference is bypassed.","Add an inference rule with omit for the problematic field, or annotate with @dontInfer on the type.","Sanitize values in sourceNodes (coerce nulls/BigInts/Symbols to strings) before createNode."],"exampleFix":"// before: field 'price' is null in the first record -> [160]\n// after: declare the type explicitly in gatsby-node.js\nexports.sourceNodes = ({ actions }) => { /* ... */ }\nexports.createSchemaCustomization = ({ actions }) => {\n  actions.createTypes(`\n    type Product implements Node {\n      price: Float\n    }\n  `)\n}","handlingStrategy":"validation","validationCode":"// Before createNode, ensure no field's example value is non-inferrable\nconst INFERRABLE = ['boolean','number','string','object']\nfunction isInferrableExample(v) {\n  if (v === null) return false\n  const t = typeof v\n  if (!INFERRABLE.includes(t)) return false           // undefined/symbol/function/bigint\n  if (t === 'object' && (Array.isArray(v) || v instanceof Date || v instanceof String)) return true\n  return true\n}\nfunction validateNode(node) {\n  for (const [k, v] of Object.entries(node)) {\n    if (v === undefined) throw new Error(`Field ${k} is undefined; cannot infer type`)\n  }\n}","typeGuard":"function isInferrableValue(value) {\n  if (value === null || value === undefined) return false\n  const t = typeof value\n  return t === 'boolean' || t === 'number' || t === 'string' ||\n    (t === 'object' && (value instanceof Date || value instanceof String || Object.getPrototypeOf(value) === Object.prototype || Object.getPrototypeOf(value) === null))\n}","tryCatchPattern":null,"preventionTips":["Always declare field types via createSchemaCustomization for any field that may be null in source data.","Sanitize source values (coerce nulls/BigInt/Symbol) in sourceNodes before createNode.","Add a unit test that runs Gatsby inference over a fixture containing null fields."],"tags":["schema","inference","graphql","type-inference"],"backgroundTag":null,"analyzedSha":"8b06340921ffdf23125a365b9c9923690cb62ce6","analyzedAt":"2026-08-13T02:36:21.405Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}