{"record":{"id":"4030917088d65f9e","repo":"gatsbyjs/gatsby","slug":"since-gatsby-v4-you-cannot-use-the-typename-be","errorCode":null,"errorMessage":"Since Gatsby v4+ you cannot use the ${typeName}.beforeChangeNode option as a function. Please make the option a relative or absolute path to a JS file where the beforeChangeNode fn is the default export.","messagePattern":"Since Gatsby v4\\+ you cannot use the (.+?)\\.beforeChangeNode option as a function\\. Please make the option a relative or absolute path to a JS file where the beforeChangeNode fn is the default export\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/gatsby-source-wordpress/src/steps/process-and-validate-plugin-options.ts","lineNumber":100,"sourceCode":"    name: `Require beforeChangeNode type setting functions by absolute or relative path`,\n    test: ({ userPluginOptions }: IProcessorOptions): boolean =>\n      !!userPluginOptions?.type,\n    processor: ({\n      helpers,\n      userPluginOptions,\n    }: IProcessorOptions): IPluginOptions => {\n      // This is the Gatsby store, so we don't access it as getStore()\n      const gatsbyStore = helpers.store.getState()\n      const typeSettings = Object.entries(userPluginOptions.type)\n\n      typeSettings.forEach(([typeName, settings]) => {\n        const beforeChangeNodePath = settings?.beforeChangeNode\n\n        if (\n          usingGatsbyV4OrGreater &&\n          typeof beforeChangeNodePath === `function`\n        ) {\n          helpers.reporter.panic(\n            `Since Gatsby v4+ you cannot use the ${typeName}.beforeChangeNode option as a function. Please make the option a relative or absolute path to a JS file where the beforeChangeNode fn is the default export.`\n          )\n        }\n\n        if (!beforeChangeNodePath || typeof beforeChangeNodePath !== `string`) {\n          return\n        }\n\n        try {\n          const absoluteRequirePath: string | undefined = path.isAbsolute(\n            beforeChangeNodePath\n          )\n            ? beforeChangeNodePath\n            : require.resolve(\n                path.join(gatsbyStore.program.directory, beforeChangeNodePath)\n              )\n\n          const beforeChangeNodeFn = require(absoluteRequirePath)","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/8b06340921ffdf23125a365b9c9923690cb62ce6/packages/gatsby-source-wordpress/src/steps/process-and-validate-plugin-options.ts#L82-L118","documentation":"Error \"Since Gatsby v4+ you cannot use the ${typeName}.beforeChangeNode option as a function. Please make the option a relative or absolute path to a JS file where the beforeChangeNode fn is the default export.\" thrown in gatsbyjs/gatsby.","triggerScenarios":"Thrown at packages/gatsby-source-wordpress/src/steps/process-and-validate-plugin-options.ts:100 when the library encounters an invalid state.","commonSituations":"Occurs when a beforeChangeNode option is passed as a function in Gatsby v4+. Move the function into a JS file and set the option to the file path so it can run in a worker.","solutions":["Move the beforeChangeNode function into a separate JS file with a default export.","Set the option to a relative or absolute path to that file instead of an inline function."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8b06340921ffdf23125a365b9c9923690cb62ce6","analyzedAt":"2026-08-13T02:36:21.405Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}