gatsbyjs/gatsby · error
page not found
Error message
page not found
What it means
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.
Source
Thrown at packages/gatsby/src/utils/dev-ssr/render-dev-html.ts:98
resolve(found)
}
})
stream.on(`error`, function () {
resolve(found)
})
stream.on(`close`, function () {
resolve(found)
})
})
const ensurePathComponentInSSRBundle = async (
page: IGatsbyPage,
directory: string,
allowTimedFallback: boolean
): Promise<boolean> => {
// This shouldn't happen.
if (!page) {
report.panic(`page not found`, page)
}
// Now check if it's written to the correct path
const htmlComponentRendererPath = nodePath.join(
directory,
ROUTES_DIRECTORY,
`render-page.js`
)
// This search takes 1-10ms
// We do it as there can be a race conditions where two pages
// are requested at the same time which means that both are told render-page.js
// has changed when the first page is complete meaning the second
// page's component won't be in the render meaning its SSR will fail.
let found = await searchFileForString(
page.componentChunkName,
htmlComponentRendererPath
)View on GitHub (pinned to 8b06340921)
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.
Defensive patterns
Strategy: validation
Validate before calling
// Validate page exists before SSR request handling
function isValidPage(page) {
return page != null && typeof page.path === 'string' && typeof page.componentChunkName === 'string'
}
if (!isValidPage(requestedPage)) {
return { statusCode: 404, body: 'Page not found' }
} Type guard
function isGatsbyPage(page) {
return (
typeof page === 'object' &&
page !== null &&
typeof page.path === 'string' &&
typeof page.componentChunkName === 'string'
)
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Slice context "${slicesContext.renderEnvironment}" is not su
- Error: matchPath property is undefined for page ${page.path}
- Missing compiler
- Missing required params
- ${err}
AI-assisted analysis of gatsbyjs/gatsby@8b06340921 (2026-08-13).
Data as JSON: /api/errors/6bfae7c11b58c359.
Report an issue: GitHub.