gatsbyjs/gatsby · error
gatsby-plugin-page-creator_12107
gatsby-plugin-page-creator_12107
Error message
"path" is a required option for gatsby-plugin-page-creator See docs here - https://www.gatsbyjs.com/plugins/gatsby-plugin-page-creator/
What it means
In gatsby-node.ts:74-84, the page-creator plugin destructures pluginOptions and checks if pagesPath is falsy. If the 'path' option was not provided (or is empty/null/undefined), reporter.panic fires with id prefixId(CODES.RequiredPath). The path option tells the plugin which directory to scan for page components (JSX/TSX/MDX files) — without it, the plugin has nothing to operate on.
Source
Thrown at packages/gatsby-plugin-page-creator/src/gatsby-node.ts:76
},
pluginOptions: IOptions,
doneCb: PluginCallback
): Promise<void> {
const {
path: pagesPath,
pathCheck = true,
ignore,
slugify: slugifyOptions,
} = pluginOptions
try {
const { deletePage } = actions
const { program, config } = store.getState()
const { trailingSlash = `always` } = config
const exts = program.extensions.map(e => `${e.slice(1)}`).join(`,`)
if (!pagesPath) {
reporter.panic({
id: prefixId(CODES.RequiredPath),
context: {
sourceMessage: `"path" is a required option for gatsby-plugin-page-creator
See docs here - https://www.gatsbyjs.com/plugins/gatsby-plugin-page-creator/`,
},
})
}
// Validate that the path exists.
if (pathCheck && !existsSync(pagesPath)) {
reporter.panic({
id: prefixId(CODES.NonExistingPath),
context: {
sourceMessage: `The path passed to gatsby-plugin-page-creator does not exist on your file system:
${pagesPath}
View on GitHub (pinned to 8b06340921)
Solutions
- Add the path option pointing to your pages directory: options: { path: `${__dirname}/src/pages` }
- Ensure the path value is a non-empty string
- Verify the options object is correctly nested under the plugin's resolve entry
Example fix
// before (gatsby-config.js)
{
resolve: `gatsby-plugin-page-creator`,
// no options provided
},
// after
{
resolve: `gatsby-plugin-page-creator`,
options: {
path: `${__dirname}/src/pages`,
},
}, Defensive patterns
Strategy: validation
Validate before calling
// Validate gatsby-config.js plugin options before build
const pageCreatorPlugin = plugins.find(
p => (typeof p === 'string' ? p : p.resolve) === 'gatsby-plugin-page-creator'
)
if (pageCreatorPlugin && typeof pageCreatorPlugin === 'object') {
if (!pageCreatorPlugin.options?.path) {
throw new Error('gatsby-plugin-page-creator requires a "path" option')
}
} Type guard
function hasValidPath(
options: unknown
): options is { path: string } {
return (
typeof options === 'object' &&
options !== null &&
'path' in options &&
typeof (options as { path: unknown }).path === 'string' &&
(options as { path: string }).path.length > 0
)
} Prevention
- Always specify the path option when registering gatsby-plugin-page-creator
- Use a config validation step before running gatsby build/develop
- Use template literals with __dirname for robust path references
When it happens
Trigger: Registering gatsby-plugin-page-creator in gatsby-config.js without a 'path' option, or with path: '' / path: null / path: undefined. Using the object form { resolve: 'gatsby-plugin-page-creator' } without an options object at all.
Common situations: Copy-paste from docs that omitted the path option. Renaming the pages directory without updating config. Plugin configuration typo (e.g. paths instead of path).
Related errors
- Oops the plugin option "defaultDataLayer" should be a plain
- gatsby-plugin-page-creator_12108
- Invalid plugin options for "gatsby-plugin-sitemap":
- Cannot specify both JPG and PNG formats
- A languageExtension needs to be defined as an object. Given
AI-assisted analysis of gatsbyjs/gatsby@8b06340921 (2026-08-13).
Data as JSON: /api/errors/35d09362c1ab9ed2.
Report an issue: GitHub.