gatsbyjs/gatsby · error
11323
11323
Error message
${pluginName} must set the page path when creating a page.\n\nThe page object passed to createPage:\n${pageObject} What it means
Thrown by Gatsby's createPage action when the page object has no `path` field (falsy). The action builds a human-readable plugin name ('Your site's gatsby-node.js' for the default plugin, else 'The plugin "<name>"'), then panics with code 11323, including the offending page object so the user can see what was passed.
Source
Thrown at packages/gatsby/src/redux/actions/public.js:198
* context: {
* id: `123456`,
* },
* })
*/
actions.createPage = (
page: IPageInput,
plugin?: Plugin,
actionOptions?: ActionOptions
) => {
let name = `The plugin "${plugin.name}"`
if (plugin.name === `default-site-plugin`) {
name = `Your site's "gatsby-node.js"`
}
if (!page.path) {
const message = `${name} must set the page path when creating a page`
// Don't log out when testing
if (isNotTestEnv) {
report.panic({
id: `11323`,
context: {
pluginName: name,
pageObject: page,
message,
},
})
} else {
return message
}
}
// Validate that the context object doesn't overlap with any core page fields
// as this will cause trouble when running graphql queries.
if (page.context && typeof page.context === `object`) {
const invalidFields = reservedFields.filter(field => field in page.context)
if (invalidFields.length > 0) {View on GitHub (pinned to 8b06340921)
Solutions
- Ensure every createPage call sets a non-empty `path` string, typically `path: `/${node.slug}/``.
- Filter or default source data so the value used for path is never null/undefined.
- Use the pageObject printed in the panic to find the offending node and the call site that produced it.
Example fix
// before
createPage({ component, context: { id } /* path missing */ })
// after
createPage({ path: `/post/${node.slug}/`, component, context: { id } }) Defensive patterns
Strategy: validation
Validate before calling
// Validate before calling createPage
if (!page.path || typeof page.path !== 'string') {
throw new Error(`createPage needs a non-empty path string; got ${page.path}`)
}
actions.createPage(page) Type guard
// Type guard for a createPage payload
function hasValidPath(p): p is { path: string } {
return typeof p?.path === 'string' && p.path.length > 0
} Prevention
- Always set path explicitly; derive it from a guaranteed non-null source field.
- Filter source nodes whose slug/title is null before generating paths.
- Add a unit test asserting every createPage call sets path.
When it happens
Trigger: A call to actions.createPage({ ... }) where `path` is undefined, empty, or omitted; the !page.path check fires.
Common situations: Building pages from a data source and forgetting to set path; a typo (e.g. `paths` instead of `path`); a slug/title field that was null in the source data and was assigned to path.
Related errors
- 11324
- 11322
- ${pluginName} must set the absolute path to the page compone
- Pages can only be created by plugins. There wasn't a plugin
- Plugin ${plugin.name} attempted to set request headers with
AI-assisted analysis of gatsbyjs/gatsby@8b06340921 (2026-08-13).
Data as JSON: /api/errors/cd462c9169970e81.
Report an issue: GitHub.