{"record":{"id":"8b482d3f03dfa103","repo":"gatsbyjs/gatsby","slug":"createnodeid-must-be-a-function-was-typeof-crea-8b482d","errorCode":null,"errorMessage":"createNodeId must be a function, was ${typeof createNodeId}","messagePattern":"createNodeId must be a function, was (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/gatsby-source-wordpress/src/steps/source-nodes/create-nodes/create-remote-file-node/index.js","lineNumber":406,"sourceCode":"  if (doneQueueTimeout) {\n    // this is to give the bar a little time to wait when there are pauses\n    // between file downloads.\n    clearTimeout(doneQueueTimeout)\n  }\n\n  // if the url isn't already encoded\n  // so decoding it doesn't do anything\n  if (decodeURI(url) === url) {\n    // encode the uri\n    // this accounts for special characters in filenames\n    url = encodeURI(url)\n  }\n\n  // validation of the input\n  // without this it's notoriously easy to pass in the wrong `createNodeId`\n  // see gatsbyjs/gatsby#6643\n  if (typeof createNodeId !== `function`) {\n    throw new Error(\n      `createNodeId must be a function, was ${typeof createNodeId}`\n    )\n  }\n  if (typeof createNode !== `function`) {\n    throw new Error(`createNode must be a function, was ${typeof createNode}`)\n  }\n  if (typeof getCache === `function`) {\n    // use cache of this plugin and not cache of function caller\n    cache = getCache(`gatsby-source-filesystem`)\n  }\n  if (typeof cache !== `object`) {\n    throw new Error(\n      `Neither \"cache\" or \"getCache\" was passed. getCache must be function that return Gatsby cache, \"cache\" must be the Gatsby cache, was ${typeof cache}`\n    )\n  }\n\n  // Check if we already requested node for this remote file\n  // and return stored promise if we did.","sourceCodeStart":388,"sourceCodeEnd":424,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/8b06340921ffdf23125a365b9c9923690cb62ce6/packages/gatsby-source-wordpress/src/steps/source-nodes/create-nodes/create-remote-file-node/index.js#L388-L424","documentation":"The gatsby-source-wordpress vendored copy of createRemoteFileNode validates createNodeId exactly like the upstream gatsby-source-filesystem version. After URL encoding, it asserts typeof createNodeId === 'function'. Non-function values are rejected with their runtime type. This guard is the first of three input validations (createNodeId, createNode, cache).","triggerScenarios":"gatsby-source-wordpress calling its internal createRemoteFileNode without forwarding createNodeId; a custom integration passing createNodeId: undefined; calling the function directly from user code without Gatsby helpers.","commonSituations":"Internal plugin bug where helpers were not threaded through to the media step; forking gatsby-source-wordpress and dropping the createNodeId forwarding; version mismatch between gatsby-source-wordpress and Gatsby core that changes helper availability.","solutions":["If you are a user, this is almost always a gatsby-source-wordpress internal bug — upgrade to the latest version.","If forking, ensure createNodeId is forwarded from helpers into the createRemoteFileNode call site.","Verify your Gatsby version is compatible with the gatsby-source-wordpress version in use.","Check that WPGQL is actually returning media items; an upstream change should not remove createNodeId but a stale cache of helpers can."],"exampleFix":"null","handlingStrategy":"validation","validationCode":"if (typeof createNodeId !== 'function') { throw new TypeError('createNodeId not available in the WordPress media step') }","typeGuard":"const isCreateNodeId = (v) => typeof v === 'function'","tryCatchPattern":"null","preventionTips":["Upgrade gatsby-source-wordpress to the latest version when this fires","Confirm Gatsby core and gatsby-source-wordpress are version-compatible","If forking, always forward createNodeId from helpers into the media step"],"tags":["wordpress","gatsby","validation","createnodeid"],"backgroundTag":null,"analyzedSha":"8b06340921ffdf23125a365b9c9923690cb62ce6","analyzedAt":"2026-08-13T02:36:21.405Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}