{"record":{"id":"cd3d4861e232da92","repo":"gatsbyjs/gatsby","slug":"the-following-page-component-must-contain-conte","errorCode":null,"errorMessage":"The following page component must contain '${CONTENT_FILE_PATH_QUERY}':\n${cleanedComponentPath}","messagePattern":"The following page component must contain '(.+?)':\n(.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/gatsby-core-utils/src/parse-component-path.ts","lineNumber":23,"sourceCode":"\nconst CONTENT_FILE_PATH_QUERY = `?__contentFilePath=`\n\n// Split the path component URI without using the expensive URI.parse()\nexport const splitComponentPath = (componentPath: string): Array<string> => {\n  // If the path does not include the contentFilePath query, we can assume its a regular path\n  if (!componentPath.includes(CONTENT_FILE_PATH_QUERY)) {\n    return [componentPath]\n  }\n\n  const cleanedComponentPath = componentPath.replace(\n    /&export=(default|head)$/,\n    ``\n  )\n  const splitPath = cleanedComponentPath.split(CONTENT_FILE_PATH_QUERY)\n\n  // We only support URI paths with the `?__contentFilePath=` parameter\n  if (splitPath.length !== 2) {\n    throw new Error(\n      `The following page component must contain '${CONTENT_FILE_PATH_QUERY}':\\n${cleanedComponentPath}`\n    )\n  }\n\n  return splitPath\n}\n\n// Get the path to the actual js page component\nexport const getPathToLayoutComponent = (componentPath: string): string =>\n  splitComponentPath(componentPath)[0]\n\n// Get the path to the content file, falling back to the js component if no content file is given.\n// Pages directly created from `.mdx` files\nexport const getPathToContentComponent = (componentPath: string): string => {\n  const splitPath = splitComponentPath(componentPath)\n  if (splitPath.length === 1) {\n    return splitPath[0]\n  }","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/e85d62f1779e353eaac1753211629a26d123e26c/packages/gatsby-core-utils/src/parse-component-path.ts#L5-L41","documentation":"splitComponentPath only understands the ?__contentFilePath= marker for MDX-style split component paths; after cleaning trailing export=... suffixes it expects exactly two segments. More than one CONTENT_FILE_PATH_QUERY occurrence (or malformed input) violates that invariant and throws, naming the offending cleaned path.","triggerScenarios":"Thrown at packages/gatsby-core-utils/src/parse-component-path.ts:23 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use at most one ?__contentFilePath= query in the component path","Check createPage calls that assemble component paths programmatically for duplicated query strings","Pass the mdx body and component as separate fields instead of a concatenated string"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e85d62f1779e353eaac1753211629a26d123e26c","analyzedAt":"2026-08-26T17:50:09.662Z","contentChangedAt":"2026-08-26T17:50:09.662Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}