{"record":{"id":"8727947f1ab78a9c","repo":"gatsbyjs/gatsby","slug":"page-pagepath-doesn-t-exist-it-might-have-be","errorCode":null,"errorMessage":"Page \"${pagePath}\" doesn't exist. It might have been deleted recently.","messagePattern":"Page \"(.+?)\" doesn't exist\\. It might have been deleted recently\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/gatsby/src/utils/get-page-data.ts","lineNumber":27,"sourceCode":"const DEFAULT_WAIT_TIMEOUT = 15 * 1000\nexport const RETRY_INTERVAL = 5 * 1000\n\nexport async function getPageData(\n  pagePath: string,\n  waitForMS: number = DEFAULT_WAIT_TIMEOUT\n): Promise<IPageDataWithQueryResult> {\n  return doGetPageData(pagePath, waitForMS, waitForMS)\n}\n\nasync function doGetPageData(\n  pagePath: string,\n  waitForMS: number,\n  initialWaitForMs: number\n): Promise<IPageDataWithQueryResult> {\n  const { queries, pendingPageDataWrites, pages } = store.getState()\n\n  if (!pages.has(pagePath)) {\n    throw new Error(\n      `Page \"${pagePath}\" doesn't exist. It might have been deleted recently.`\n    )\n  }\n\n  const query = queries.trackedQueries.get(pagePath)\n\n  if (!query) {\n    throw new Error(`Could not find query ${pagePath}`)\n  }\n  if (query.running !== 0) {\n    return waitNextPageData(pagePath, waitForMS, initialWaitForMs)\n  }\n  if (query.dirty !== 0) {\n    emitter.emit(`QUERY_RUN_REQUESTED`, { pagePath })\n    return waitNextPageData(pagePath, waitForMS, initialWaitForMs)\n  }\n  if (pendingPageDataWrites.pagePaths.has(pagePath)) {\n    return waitNextPageData(pagePath, waitForMS, initialWaitForMs)","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/8b06340921ffdf23125a365b9c9923690cb62ce6/packages/gatsby/src/utils/get-page-data.ts#L9-L45","documentation":"getPageData/doGetPageData first checks the redux pages map; if pages.has(pagePath) is false the page was never created (or was deleted) and the request cannot be served, so it throws.","triggerScenarios":"Requesting page-data for a path with no corresponding createPage; client navigation to a page removed during HMR; SSR/dev request for a mistyped path.","commonSituations":"Page deleted between request and processing; wrong/typo path; createPage never called for that route; race during hot reload.","solutions":["Verify the path matches an actual created page (check createPage calls and the pages redux state).","Handle the deletion race by re-fetching or falling back to a 404 page.","Ensure createPage runs before client/dev requests hit that path."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const { store } = require('gatsby/dist/redux')\nfunction pageExists(pagePath) {\n  return store.getState().pages.has(pagePath)\n}","typeGuard":"function pageExistsInStore(state, pagePath) { return state.pages.has(pagePath) }","tryCatchPattern":"try {\n  const data = await getPageData(pagePath)\n} catch (err) {\n  if (/doesn't exist/.test(err.message)) { /* serve 404 or re-trigger createPage */ }\n  else throw err\n}","preventionTips":["Validate pagePath against the pages store before requesting page-data.","Handle deletion races in dev by falling back to a 404 page.","Ensure createPage completes before advertising the route to clients."],"tags":["page-data","runtime","pages"],"backgroundTag":null,"analyzedSha":"8b06340921ffdf23125a365b9c9923690cb62ce6","analyzedAt":"2026-08-13T02:36:21.405Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}