{"record":{"id":"387974e6774ba47f","repo":"gatsbyjs/gatsby","slug":"ensureresources-was-not-able-to-find-resources-for","errorCode":null,"errorMessage":"EnsureResources was not able to find resources for path: \"${this.props.location.pathname}\"\nThis typically means that an issue occurred building components for that path.\nRun `gatsby clean` to remove any cached elements.","messagePattern":"EnsureResources was not able to find resources for path: \"(.+?)\"\nThis typically means that an issue occurred building components for that path\\.\nRun `gatsby clean` to remove any cached elements\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/gatsby/cache-dir/ensure-resources.js","lineNumber":112,"sourceCode":"    }\n    return shallowCompare(this, nextProps, nextState)\n  }\n\n  render() {\n    if (\n      process.env.NODE_ENV !== `production` &&\n      (!this.state.pageResources ||\n        this.state.pageResources.status === PageResourceStatus.Error)\n    ) {\n      const message = `EnsureResources was not able to find resources for path: \"${this.props.location.pathname}\"\nThis typically means that an issue occurred building components for that path.\nRun \\`gatsby clean\\` to remove any cached elements.`\n      if (this.state.pageResources?.error) {\n        console.error(message)\n        throw this.state.pageResources.error\n      }\n\n      throw new Error(message)\n    }\n\n    return this.props.children(this.state)\n  }\n}\n\nexport default EnsureResources\n","sourceCodeStart":94,"sourceCodeEnd":120,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/8b06340921ffdf23125a365b9c9923690cb62ce6/packages/gatsby/cache-dir/ensure-resources.js#L94-L120","documentation":"Thrown by the EnsureResources React component when it cannot find page resources for the current location pathname, or when those resources have an Error status. EnsureResources is responsible for loading the JS chunk and page-data JSON for a route before rendering; if the resources are missing or errored during build, the component throws (or re-throws a captured build error).","triggerScenarios":"Client-side navigation to a path whose page-data.json was never generated (build failed for that page), the page resources loaded but the chunk threw an error (stored in pageResources.error), or a stale .cache directory has incomplete resources.","commonSituations":"A page threw an error during 'gatsby build' but the build partially succeeded; the .cache or public directory is corrupt or stale after a failed build; deploying incomplete build output; or a client-only route that was never created via createPage.","solutions":["Run `gatsby clean` to remove .cache and public, then rebuild.","Check the build output for errors on the specific path — a page-level build error often leaves pageResources in an Error state.","Verify the path exists in your site's generated pages (check public/page-data/ for the corresponding JSON).","If the error includes pageResources.error, read that error's stack — it is the root cause of the failed page build."],"exampleFix":"# before — stale cache after a failed build\nnpm run build  # partial failure, .cache is corrupt\n\n# after\ngatsby clean\nnpm run build  # fresh build","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Wrap EnsureResources-dependent rendering in an error boundary\nimport React from 'react'\n\nclass ResourceErrorBoundary extends React.Component {\n  state = { hasError: false }\n  static getDerivedStateFromError() { return { hasError: true } }\n  render() {\n    if (this.state.hasError) {\n      return <div>Page unavailable. Try refreshing.</div>\n    }\n    return this.props.children\n  }\n}","preventionTips":["Run `gatsby clean` after any failed build before retrying.","Monitor build CI for page-level errors — fix them before deploying.","Deploy only complete, successful builds — never partial output.","Implement a client-side error boundary to gracefully handle missing resources."],"tags":["client-side","page-resources","build-cache","routing","ensure-resources"],"backgroundTag":null,"analyzedSha":"8b06340921ffdf23125a365b9c9923690cb62ce6","analyzedAt":"2026-08-13T02:36:21.405Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}