{"record":{"id":"af49f5e93af77acd","repo":"gatsbyjs/gatsby","slug":"couldn-t-find-source-url-for-media-item-databas","errorCode":null,"errorMessage":"Couldn't find source url for media item #${databaseId}","messagePattern":"Couldn't find source url for media item #(.+?)","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":163,"sourceCode":"      )\n    )\n    reporter.panic(error)\n  } else {\n    console.error(error)\n    reporter.panic()\n  }\n}\n\nexport const getFileNodeByMediaItemNode = async ({\n  mediaItemNode,\n  helpers,\n}) => {\n  const { sourceUrl, modifiedGmt, mediaItemUrl, databaseId } = mediaItemNode\n\n  const fileUrl = sourceUrl || mediaItemUrl\n\n  if (!fileUrl) {\n    helpers.reporter.warn(\n      formatLogMessage(`Couldn't find source url for media item #${databaseId}`)\n    )\n    return null\n  }\n\n  const existingNodeMeta = getFileNodeMetaBySourceUrl(fileUrl)\n\n  if (\n    // if we already have this image\n    existingNodeMeta &&\n    existingNodeMeta.id &&\n    // and it hasn't been modified\n    existingNodeMeta.modifiedGmt === modifiedGmt\n  ) {\n    let node = await helpers.getNode(existingNodeMeta.id)\n\n    // some of the cached node metas don't necessarily need to be a File\n    // so make sure we return a File node if what we get isn't one","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/e85d62f1779e353eaac1753211629a26d123e26c/packages/gatsby-source-wordpress/src/steps/source-nodes/create-nodes/create-local-file-node.js#L145-L181","documentation":"Data-quality guard when looking up an existing local file node for a media item: neither sourceUrl nor mediaItemUrl is present on the media item node, so there is no URL to key the lookup on. The helper warns (via formatLogMessage) and returns null, which typically triggers a fresh fetch/creation path for that media item.","triggerScenarios":"Thrown at packages/gatsby-source-wordpress/src/steps/source-nodes/create-nodes/create-local-file-node.js:163 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the media item node in GraphiQL to confirm which URL fields are populated","Re-sync media: run `gatsby clean` and re-develop so the media item is re-fetched with full fields","Check WPGraphQL permissions — private/unpublished media may omit URL fields for the configured auth user","If persistent, exclude the problematic content type or fix the upstream WordPress data"],"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"}