{"record":{"id":"6bfae7c11b58c359","repo":"gatsbyjs/gatsby","slug":"page-not-found","errorCode":null,"errorMessage":"page not found","messagePattern":"page not found","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/gatsby/src/utils/dev-ssr/render-dev-html.ts","lineNumber":98,"sourceCode":"        resolve(found)\n      }\n    })\n    stream.on(`error`, function () {\n      resolve(found)\n    })\n    stream.on(`close`, function () {\n      resolve(found)\n    })\n  })\n\nconst ensurePathComponentInSSRBundle = async (\n  page: IGatsbyPage,\n  directory: string,\n  allowTimedFallback: boolean\n): Promise<boolean> => {\n  // This shouldn't happen.\n  if (!page) {\n    report.panic(`page not found`, page)\n  }\n\n  // Now check if it's written to the correct path\n  const htmlComponentRendererPath = nodePath.join(\n    directory,\n    ROUTES_DIRECTORY,\n    `render-page.js`\n  )\n\n  // This search takes 1-10ms\n  // We do it as there can be a race conditions where two pages\n  // are requested at the same time which means that both are told render-page.js\n  // has changed when the first page is complete meaning the second\n  // page's component won't be in the render meaning its SSR will fail.\n  let found = await searchFileForString(\n    page.componentChunkName,\n    htmlComponentRendererPath\n  )","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/8b06340921ffdf23125a365b9c9923690cb62ce6/packages/gatsby/src/utils/dev-ssr/render-dev-html.ts#L80-L116","documentation":"During develop SSR, ensurePathComponentInSSRBundle receives a page object. The comment 'This shouldn't happen' signals this is an internal invariant -- a page lookup returned undefined/falsy. The panic passes the falsy page value as context, which is not useful but indicates a lookup-by-path failure in the SSR request pipeline.","triggerScenarios":"A request comes in for a page path, the page is looked up in the store/pages map, and the result is undefined. This happens during dev-SSR when the page does not exist in Redux state -- e.g. after a page was deleted but before the dev server invalidated it, or a race condition during page recreation.","commonSituations":"Navigating to a page path in develop that was just deleted or renamed. A race condition where the page store is mid-update during a request. An incorrect page path in a Link component pointing to a non-existent route. Internal state desync during rapid edits.","solutions":["Refresh the browser -- this is often a transient dev-server state desync.","Run `gatsby clean` and restart `gatsby develop`.","Verify the page path being requested actually exists (check gatsby-page-utils / page-creator output).","If a custom page-creation plugin is involved, ensure it creates pages synchronously and correctly in createPages."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Validate page exists before SSR request handling\nfunction isValidPage(page) {\n  return page != null && typeof page.path === 'string' && typeof page.componentChunkName === 'string'\n}\n\nif (!isValidPage(requestedPage)) {\n  return { statusCode: 404, body: 'Page not found' }\n}","typeGuard":"function isGatsbyPage(page) {\n  return (\n    typeof page === 'object' &&\n    page !== null &&\n    typeof page.path === 'string' &&\n    typeof page.componentChunkName === 'string'\n  )\n}","tryCatchPattern":null,"preventionTips":["This is often transient -- refresh the browser or restart gatsby develop.","Ensure page-creation plugins create pages synchronously in createPages.","Verify Link to props point to valid routes.","Run gatsby clean to reset dev server state."],"tags":["ssr","develop","pages","race-condition","internal"],"backgroundTag":null,"analyzedSha":"8b06340921ffdf23125a365b9c9923690cb62ce6","analyzedAt":"2026-08-13T02:36:21.405Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}