{"record":{"id":"7ed55b1eb5238c2b","repo":"gatsbyjs/gatsby","slug":"gatsby-plugin-page-creator-12109","errorCode":"gatsby-plugin-page-creator_12109","errorMessage":"${e.message}","messagePattern":"\\$\\{e\\.message\\}","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/gatsby-plugin-page-creator/src/gatsby-node.ts","lineNumber":273,"sourceCode":"      pagesGlob,\n      addedPath => {\n        try {\n          if (!knownFiles.has(addedPath)) {\n            createPage(\n              addedPath,\n              pagesDirectory,\n              actions,\n              graphql,\n              reporter,\n              trailingSlash,\n              pagesPath,\n              ignore,\n              slugifyOptions\n            )\n            knownFiles.add(addedPath)\n          }\n        } catch (e) {\n          reporter.panic({\n            id: prefixId(CODES.FileSystemAdd),\n            context: {\n              sourceMessage: e.message,\n            },\n          })\n        }\n      },\n      removedPath => {\n        // Delete the page for the now deleted component.\n        try {\n          const componentPath = systemPath.join(pagesDirectory, removedPath)\n          store.getState().pages.forEach(page => {\n            if (page.component === componentPath) {\n              deletePage({\n                path: page.path,\n                component: componentPath,\n              })\n            }","sourceCodeStart":255,"sourceCodeEnd":291,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/8b06340921ffdf23125a365b9c9923690cb62ce6/packages/gatsby-plugin-page-creator/src/gatsby-node.ts#L255-L291","documentation":"In gatsby-node.ts:255-275, the plugin sets up a file watcher on the pages directory. When a new file is added (addedPath callback), it calls the page creation logic. If any exception is thrown during that process (e.g. file parsing, slug generation, page creation), the catch block wraps it with id CODES.FileSystemAdd and passes e.message as the sourceMessage. The original error is surfaced through the structured panic context.","triggerScenarios":"A file is added to the watched pages directory during develop mode but causes an error during processing — e.g. a syntax error in the component, a slug collision, a file system permission issue, or an error in a custom slugify function.","commonSituations":"Hot-reload during gatsby develop when a new file is saved with a syntax error. File permission issues on the pages directory. Custom slugifyOptions function that throws. File system race conditions during rapid file creation.","solutions":["Read the e.message value in the error output — it contains the actual underlying error","Fix the syntax/parse error in the newly added file","Check file permissions on the pages directory","If using a custom slugify function, ensure it handles all file name patterns without throwing"],"exampleFix":"// before: a file with a syntax error triggers the panic during develop\n// The error message will contain the actual parse error\n// Fix the underlying file:\n\n// src/pages/broken-page.js (had a syntax error)\n// after: fix the syntax\nexport default function Page() {\n  return <div>Fixed</div>\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// The plugin already wraps file-add logic in try-catch internally.\n// To guard as a consumer, validate your page components are syntactically\n// valid before adding them to the pages directory during develop mode.\n//\n// Use a pre-commit hook or file watcher that runs a syntax check:\nconst { execSync } = require('child_process')\ntry {\n  execSync(`npx eslint --no-eslintrc --parser-options=ecmaVersion:2020,sourceType:module,ecmaFeatures:{jsx:true} ${newFilePath}`, { stdio: 'pipe' })\n} catch (e) {\n  console.warn(`File ${newFilePath} has syntax issues — fix before saving to pages/`)\n}","preventionTips":["Validate new page files are syntactically correct before saving during develop","Keep slugify functions defensive — handle all file name patterns without throwing","Monitor develop-mode console for file-add errors and fix immediately"],"tags":["filesystem","watcher","page-creator","runtime-error"],"backgroundTag":null,"analyzedSha":"8b06340921ffdf23125a365b9c9923690cb62ce6","analyzedAt":"2026-08-13T02:36:21.405Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}