{"record":{"id":"b3f8fec63b526a89","repo":"gatsbyjs/gatsby","slug":"pluginname-must-set-the-absolute-path-to-the-pa","errorCode":null,"errorMessage":"${pluginName} must set the absolute path to the page component when creating a page","messagePattern":"(.+?) must set the absolute path to the page component when creating a page","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/gatsby/src/redux/actions/public.js","lineNumber":307,"sourceCode":"\n  const { error, panicOnBuild } = validateComponent({\n    input: page,\n    pluginName: name,\n    errorIdMap: {\n      noPath: `11322`,\n      notAbsolute: `11326`,\n      doesNotExist: `11325`,\n      empty: `11327`,\n      noDefaultExport: `11328`,\n    },\n  })\n\n  if (error) {\n    if (isNotTestEnv) {\n      if (panicOnBuild) {\n        report.panicOnBuild(error)\n      } else {\n        report.panic(error)\n      }\n    }\n    return `${name} must set the absolute path to the page component when creating a page`\n  }\n\n  // check if we've processed this component path\n  // before, before running the expensive \"trueCasePath\"\n  // operation\n  //\n  // Skip during testing as the paths don't exist on disk.\n  if (isNotTestEnv) {\n    if (pageComponentCache.has(page.component)) {\n      page.component = pageComponentCache.get(page.component)\n    } else {\n      const originalPageComponent = page.component\n      const splitPath = splitComponentPath(page.component)\n\n      // normalize component path","sourceCodeStart":289,"sourceCodeEnd":325,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/8b06340921ffdf23125a365b9c9923690cb62ce6/packages/gatsby/src/redux/actions/public.js#L289-L325","documentation":"Thrown by createPage when validateComponent returns an error (component path issues) but the error does not set panicOnBuild, so report.panic is invoked. Covers cases where the component path is not absolute, points to a non-existent file, is empty, or has no default export. The returned string message is the user-facing fallback used in test env.","triggerScenarios":"page.component fails validateComponent: not absolute (11326), does not exist (11325), empty (11327), or no default export (11328); panicOnBuild is false so report.panic runs.","commonSituations":"Passing a relative path like `./src/templates/x.js`; a typo in the filename; a template file with no `export default`; case-sensitivity mismatch between macOS dev and Linux CI (trueCasePathSync reveals mismatches).","solutions":["Use path.resolve to build an absolute component path.","Confirm the file exists on disk with the exact casing used in code.","Ensure the component file has a default export.","Check the specific validateComponent error code (11325-11328) printed for the precise failure."],"exampleFix":"// before (relative path)\ncreatePage({ path: `/p/`, component: `./src/templates/post.js` })\n// after (absolute + default export)\ncreatePage({ path: `/p/`, component: path.resolve(`./src/templates/post.js`) })\n// src/templates/post.js\nexport default ({ data }) => <h1>{data.wpPost.title}</h1>","handlingStrategy":"validation","validationCode":"const path = require('path'), fs = require('fs')\nconst abs = path.isAbsolute(page.component) ? page.component : path.resolve(page.component)\nif (!fs.existsSync(abs)) throw new Error(`Component not found: ${abs}`)\nactions.createPage({ ...page, component: abs })","typeGuard":"function isAbsoluteExistingComponent(p: string): boolean {\n  return typeof p === 'string' && path.isAbsolute(p) && require('fs').existsSync(p)\n}","tryCatchPattern":null,"preventionTips":["Always resolve component paths to absolute with path.resolve.","Match file casing exactly to avoid Linux CI failures.","Ensure each template has a default export."],"tags":["pages","createpage","component","path","validation"],"backgroundTag":null,"analyzedSha":"8b06340921ffdf23125a365b9c9923690cb62ce6","analyzedAt":"2026-08-13T02:36:21.405Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}