gatsbyjs/gatsby · error
Page template details for "${page.componentChunkName}" not f
Error message
Page template details for "${page.componentChunkName}" not found What it means
Thrown in `getData` after a page is found but its `componentChunkName` is missing from the `INLINED_TEMPLATE_TO_DETAILS` map. That map registers the compiled page template (query + component metadata) inlined into the page-ssr engine bundle. A miss means the page-ssr engine and the page-state store disagree: the page exists in the data store but its template was not bundled/inlined.
Source
Thrown at packages/gatsby/src/utils/page-ssr-module/entry.ts:160
)
findMetaActivity.start()
}
potentialPagePath = getPagePathFromPageDataPath(pathName) || pathName
// 1. Find a page for pathname
const maybePage = findEnginePageByPath(potentialPagePath)
if (!maybePage) {
// page not found, nothing to run query for
throw new Error(`Page for "${pathName}" not found`)
}
page = maybePage
// 2. Lookup query used for a page (template)
templateDetails = INLINED_TEMPLATE_TO_DETAILS[page.componentChunkName]
if (!templateDetails) {
throw new Error(
`Page template details for "${page.componentChunkName}" not found`
)
}
} finally {
if (findMetaActivity) {
findMetaActivity.end()
}
}
const executionPromises: Array<Promise<any>> = []
// 3. Execute query
// query-runner handles case when query is not there - so maybe we should consider using that somehow
let results: IExecutionResult = {}
let serverData: IServerData | undefined
if (templateDetails.query) {
let runningQueryActivity: MaybePhantomActivity
if (getDataWrapperActivity) {View on GitHub (pinned to 8b06340921)
Solutions
- Wipe the cache and rebuild from scratch: `rm -rf .cache public && gatsby build`.
- Confirm the deployment ships the `.cache` directory (page-ssr bundle + datastore) from the same build run.
- Audit plugins that touch page components or `componentChunkName` for incompatibility with the current Gatsby version.
- Re-pin to a known-good Gatsby patch version if the error appeared after an upgrade.
Defensive patterns
Strategy: validation
Validate before calling
// CI check: assert every page's componentChunkName is in the inlined template set
const missing = pages.filter(p => !templateDetailsByChunk[p.componentChunkName])
if (missing.length) throw new Error('Stale cache: rebuild .cache/page-ssr') Prevention
- Always rebuild `.cache` and `public` together; never mix artifacts from separate builds.
- Pin a single Gatsby version across build and serve environments.
- Avoid plugins that mutate `componentChunkName`.
When it happens
Trigger: A page is registered in the datastore with a `componentChunkName` whose template was not inlined into the page-ssr bundle during the same build. Happens when `.cache/page-ssr` is rebuilt but the datastore is stale, when a plugin mutates `componentChunkName` after template inlining, or when serving a build whose page-ssr bundle predates newly added pages.
Common situations: Mixing outputs from two different `gatsby build` runs (datastore from one, page-ssr from another); upgrading Gatsby across a version that changed template-inlining without clearing `.cache`; a plugin that overrides `componentChunkName` to a value never registered with the SSR engine.
Related errors
- Incompatible DSG/SSR executing environment. Function was bui
- Unexpected result of config factory. Expected "function", go
- Page for "${pathName}" not found
- Failed to read ${siteDir}/api-runner-ssr.js
- You must specify either a cache or a directory
AI-assisted analysis of gatsbyjs/gatsby@8b06340921 (2026-08-13).
Data as JSON: /api/errors/06f1578415e41da8.
Report an issue: GitHub.