{"record":{"id":"537161d117ffb3f4","repo":"gatsbyjs/gatsby","slug":"error-occurred-while-fetching-media-item-node-d","errorCode":null,"errorMessage":"Error occurred while fetching media item #${node.databaseId}\nMedia item link: ${node.link}\nEdit link: ${editUrl}\nFile url: ${node.mediaItemUrl}\n\nThis error will fail production builds.","messagePattern":"Error occurred while fetching media item #(.+?)\nMedia item link: (.+?)\nEdit link: (.+?)\nFile url: (.+?)\n\nThis error will fail production builds\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/gatsby-source-wordpress/src/steps/source-nodes/create-nodes/create-local-file-node.js","lineNumber":83,"sourceCode":"    typeof error === `string` ? error : error && error.toString()\n\n  const { pluginOptions } = getStore().getState().gatsbyApi\n  const allow404ImagesInProduction = pluginOptions.production.allow404Images\n  const allow401ImagesInProduction = pluginOptions.production.allow401Images\n  const errorCodeIs404 = errorString.includes(`Response code 404`)\n  const errorCodeIs401 = errorString.includes(`Response code 401`)\n  const errorCode = errorCodeIs404 ? `404` : errorCodeIs401 ? `401` : null\n\n  if (\n    (allow404ImagesInProduction ||\n      allow401ImagesInProduction ||\n      process.env.NODE_ENV !== `production`) &&\n    (errorCodeIs404 || errorCodeIs401)\n  ) {\n    fetchState.shouldBail = true\n\n    reporter.log(``)\n    reporter.warn(\n      formatLogMessage(\n        `Error ${sharedError}${\n          !allow404ImagesInProduction || !allow401ImagesInProduction\n            ? `\\n\\nThis error will fail production builds.`\n            : ``\n        }`\n      )\n    )\n    reporter.log(``)\n\n    return\n  }\n\n  if (errorString.includes(`Response code 4`)) {\n    reporter.log(``)\n\n    reporter.info(\n      formatLogMessage(","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/e85d62f1779e353eaac1753211629a26d123e26c/packages/gatsby-source-wordpress/src/steps/source-nodes/create-nodes/create-local-file-node.js#L65-L101","documentation":"Error \"Error occurred while fetching media item #${node.databaseId}\nMedia item link: ${node.link}\nEdit link: ${editUrl}\nFile url: ${node.mediaItemUrl}\n\nThis error will fail production builds.\" thrown in gatsbyjs/gatsby.","triggerScenarios":"Thrown at packages/gatsby-source-wordpress/src/steps/source-nodes/create-nodes/create-local-file-node.js:83 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check whether the media URL actually returns 404/401 in a browser or curl; if the asset was deleted or made private in WordPress, restore it or remove the reference","For legitimately missing assets in production, set production.allow404Images or allow401Images to true in gatsby-source-wordpress options to tolerate them","Verify the WordPress URL and media files are publicly accessible (no hotlink protection, auth or CDN rule blocking server-side requests)","Increase timeouts or retry after transient server errors; re-run the build once WordPress is responsive"],"exampleFix":null,"handlingStrategy":"fallback","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-14T00:17:10.932Z"}