{"record":{"id":"e992f47cae26c5e0","repo":"gatsbyjs/gatsby","slug":"failed-to-process-search-and-replace-string-in-n","errorCode":null,"errorMessage":"Failed to process search and replace string in ${node.__typename} ${node.id}","messagePattern":"Failed to process search and replace string in (.+?) (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/gatsby-source-wordpress/src/steps/source-nodes/create-nodes/process-node.js","lineNumber":913,"sourceCode":"export const searchAndReplaceNodeStrings = ({\n  nodeString,\n  node,\n  pluginOptions,\n}) => {\n  if (Array.isArray(pluginOptions?.searchAndReplace)) {\n    pluginOptions.searchAndReplace.forEach(({ search, replace }) => {\n      const searchRegex = new RegExp(search, `g`)\n\n      const stringMatches = execall(searchRegex, nodeString)\n\n      if (stringMatches.length) {\n        stringMatches.forEach(({ match }) => {\n          if (match) {\n            try {\n              nodeString = nodeString.replace(search, replace)\n            } catch (e) {\n              console.error(e)\n              console.warn(\n                formatLogMessage(\n                  `Failed to process search and replace string in ${node.__typename} ${node.id}`\n                )\n              )\n            }\n          }\n        })\n      }\n    })\n  }\n\n  return nodeString\n}\n\nconst processNodeString = async ({\n  nodeString,\n  node,\n  pluginOptions,","sourceCodeStart":895,"sourceCodeEnd":931,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/e85d62f1779e353eaac1753211629a26d123e26c/packages/gatsby-source-wordpress/src/steps/source-nodes/create-nodes/process-node.js#L895-L931","documentation":"Warns that a searchAndReplace entry from plugin options failed when applied to the node's serialized string. The search pattern is compiled as a RegExp and the replacement run inside try/catch; a malformed regex or invalid replacement pattern makes it throw, and the node keeps its unmodified string.","triggerScenarios":"Thrown at packages/gatsby-source-wordpress/src/steps/source-nodes/create-nodes/process-node.js:913 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the invalid entries in pluginOptions.searchAndReplace (bad regex in the `search` string)","Test each `search` value with new RegExp() before configuring it"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e85d62f1779e353eaac1753211629a26d123e26c","analyzedAt":"2026-08-26T17:50:09.662Z","contentChangedAt":"2026-08-26T17:50:09.662Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}