{"record":{"id":"98a32fa4ed53ad86","repo":"vercel/next.js","slug":"pages-and-app-directories-should-be-under-th","errorCode":null,"errorMessage":"> `pages` and `app` directories should be under the same folder","messagePattern":"> `pages` and `app` directories should be under the same folder","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/next/src/lib/find-pages-dir.ts","lineNumber":32,"sourceCode":"\nexport function findPagesDir(dir: string): {\n  pagesDir: string | undefined\n  appDir: string | undefined\n} {\n  const pagesDir = findDir(dir, 'pages') || undefined\n  const appDir = findDir(dir, 'app') || undefined\n\n  if (appDir == null && pagesDir == null) {\n    throw new Error(\n      \"> Couldn't find any `pages` or `app` directory. Please create one under the project root\"\n    )\n  }\n\n  if (pagesDir && appDir) {\n    const pagesParent = path.dirname(pagesDir)\n    const appParent = path.dirname(appDir)\n    if (pagesParent !== appParent) {\n      throw new Error(\n        '> `pages` and `app` directories should be under the same folder'\n      )\n    }\n  }\n\n  return {\n    pagesDir,\n    appDir,\n  }\n}\n","sourceCodeStart":14,"sourceCodeEnd":43,"githubUrl":"https://github.com/vercel/next.js/blob/0eb377541648e63402a47b38fee00a8d0ce8f8f1/packages/next/src/lib/find-pages-dir.ts#L14-L43","documentation":"Layout consistency check in findPagesDir: both pages/ and app/ were found but their parent directories differ (e.g. one under src/ and one at the root). The router cannot disambiguate route precedence between split directories, so the mixed layout is rejected at startup.","triggerScenarios":"pages and app directories are found in different parent folders.","commonSituations":"A project mixes src/app with top-level pages/ instead of colocating them under the same folder.","solutions":["Move pages/ and app/ so both live at the project root or both under src/."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0eb377541648e63402a47b38fee00a8d0ce8f8f1","analyzedAt":"2026-08-19T02:10:13.922Z","contentChangedAt":"2026-08-19T02:10:13.922Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}