{"record":{"id":"fb4d8c8e68edbd5a","repo":"vercel/next.js","slug":"rewrites-redirects-and-headers-are-not-applied-w","errorCode":null,"errorMessage":"rewrites, redirects, and headers are not applied when exporting your application, detected (${customRoutes.join(', ')}). See more info here: https://nextjs.org/docs/messages/export-no-custom-routes","messagePattern":"rewrites, redirects, and headers are not applied when exporting your application, detected \\((.+?)\\)\\. See more info here: https://nextjs\\.org/docs/messages/export-no-custom-routes","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/next/src/export/index.ts","lineNumber":252,"sourceCode":"\n  if (!options.silent && !options.buildExport) {\n    Log.info(`using build directory: ${distDir}`)\n  }\n\n  const buildIdFile = join(distDir, BUILD_ID_FILE)\n\n  if (!existsSync(buildIdFile)) {\n    throw new ExportError(\n      `Could not find a production build in the '${distDir}' directory. Try building your app with 'next build' before starting the static export. https://nextjs.org/docs/messages/next-export-no-build-id`\n    )\n  }\n\n  const customRoutes = (['rewrites', 'redirects', 'headers'] as const).filter(\n    (config) => typeof nextConfig[config] === 'function'\n  )\n\n  if (!hasNextSupport && !options.buildExport && customRoutes.length > 0) {\n    Log.warn(\n      `rewrites, redirects, and headers are not applied when exporting your application, detected (${customRoutes.join(\n        ', '\n      )}). See more info here: https://nextjs.org/docs/messages/export-no-custom-routes`\n    )\n  }\n\n  const buildId = await fs.readFile(buildIdFile, 'utf8')\n\n  const pagesManifest =\n    !options.pages &&\n    (require(join(distDir, SERVER_DIRECTORY, PAGES_MANIFEST)) as PagesManifest)\n\n  let previewProps: DeepReadonly<PreviewPropsManifest> | undefined\n  try {\n    previewProps = require(join(distDir, 'server', PREVIEW_PROPS_MANIFEST))\n  } catch {}\n\n  let prerenderManifest: DeepReadonly<PrerenderManifest> | undefined","sourceCodeStart":234,"sourceCodeEnd":270,"githubUrl":"https://github.com/vercel/next.js/blob/258b1c1bc05f7099816b88f70b7b3422b24a4b8d/packages/next/src/export/index.ts#L234-L270","documentation":"Error \"rewrites, redirects, and headers are not applied when exporting your application, detected (${customRoutes.join(', ')}). See more info here: https://nextjs.org/docs/messages/export-no-custom-routes\" thrown in vercel/next.js.","triggerScenarios":"Thrown at packages/next/src/export/index.ts:250 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove `output: \"export\"` if you rely on rewrites/redirects/headers, or implement them at the static host level."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"258b1c1bc05f7099816b88f70b7b3422b24a4b8d","analyzedAt":"2026-08-19T02:10:13.922Z","contentChangedAt":"2026-08-19T02:10:13.922Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}