{"record":{"id":"66e713be5332f4ac","repo":"vercel/next.js","slug":"error-you-provided-query-values-for-path-whic","errorCode":null,"errorMessage":"\nError: you provided query values for ${path} which is an auto-exported page. These can not be applied since the page can no longer be re-rendered on the server. To disable auto-export for this page add `getInitialProps`\n","messagePattern":"\nError: you provided query values for (.+?) which is an auto-exported page\\. These can not be applied since the page can no longer be re-rendered on the server\\. To disable auto-export for this page add `getInitialProps`\n","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/next/src/export/routes/pages.ts","lineNumber":82,"sourceCode":"    ...params,\n  }\n\n  if (components.getStaticProps && !htmlFilepath.endsWith('.html')) {\n    // make sure it ends with .html if the name contains a dot\n    htmlFilepath += '.html'\n    htmlFilename += '.html'\n  }\n\n  let renderResult: RenderResult | undefined\n\n  if (typeof components.Component === 'string') {\n    renderResult = RenderResult.fromStatic(\n      components.Component,\n      HTML_CONTENT_TYPE_HEADER\n    )\n\n    if (hasOrigQueryValues) {\n      throw new Error(\n        `\\nError: you provided query values for ${path} which is an auto-exported page. These can not be applied since the page can no longer be re-rendered on the server. To disable auto-export for this page add \\`getInitialProps\\`\\n`\n      )\n    }\n  } else {\n    /**\n     * This sets environment variable to be used at the time of SSR by head.tsx.\n     * Using this from process.env allows targeting SSR by calling\n     * `process.env.__NEXT_OPTIMIZE_CSS`.\n     */\n    if (renderOpts.optimizeCss) {\n      process.env.__NEXT_OPTIMIZE_CSS = JSON.stringify(true)\n    }\n    try {\n      renderResult = await lazyRenderPagesPage(\n        req,\n        res,\n        page,\n        searchAndDynamicParams,","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/vercel/next.js/blob/0ae8c72462952df163f1b1e0726641bc5b40dc93/packages/next/src/export/routes/pages.ts#L64-L100","documentation":"Thrown when a Pages Router page is auto-exported (purely static: no getInitialProps, no getStaticProps, Component is a static HTML string) but the export attempt carries original query string values. Because an auto-exported page is prerendered once and shipped as static HTML, server-side re-render with query params is impossible, so applying query values would silently drop them. Next.js surfaces this so the developer opts into data fetching explicitly.","triggerScenarios":"An exportPathMap (or programmatic export) maps a URL with query params to a page that has no getInitialProps/getStaticProps/getServerSideProps. The export worker sees hasOrigQueryValues === true on a string-typed Component and aborts.","commonSituations":"Using a custom exportPathMap that appends ?query=... entries to a static page; legacy migration where query strings were once tolerated; or routing utilities that preserve search params into the export target. Also appears after upgrading from an older Next.js version that silently ignored the query.","solutions":["Add a getInitialProps (or getStaticProps) to the page so it becomes server-rendered and can legitimately consume query params.","Strip query parameters from the exportPathMap entries so the static page is exported for the bare pathname only.","If the page is meant to read query at runtime, convert it to use getServerSideProps (and drop output:'export').","Re-evaluate whether the params belong in the path (dynamic route) rather than the query string."],"exampleFix":"// before — pages/search.js (auto-exported, no data fns)\nexport default function Search() { return <SearchClient /> }\n// exportPathMap injects ?q=foo -> error\n// after — opt out of auto-export\nSearch.getInitialProps = (ctx) => {\n  return { query: ctx.query.q || '' }\n}","handlingStrategy":"validation","validationCode":"// If using exportPathMap, strip query params for auto-exported (no-data-fn) pages\nfunction sanitizeExportMap(exportMap: Record<string, { query?: object; page: string }>, dataFns: Set<string>) {\n  for (const [path, entry] of Object.entries(exportMap)) {\n    if (entry.query && !dataFns.has(entry.page)) {\n      delete entry.query // auto-exported page cannot take query\n    }\n  }\n}","typeGuard":"function pageAcceptsQuery(mod: any): boolean {\n  return Boolean(mod.getInitialProps || mod.getStaticProps || mod.getServerSideProps)\n}","tryCatchPattern":"// Build-time; surface clearly in CI logs\ntry { await exec('next build') }\ncatch (e) {\n  if (/auto-exported page/.test(e.message)) console.error('Strip query params from exportPathMap or add getInitialProps')\n  throw e\n}","preventionTips":["Avoid injecting query strings into exportPathMap entries for static pages.","If a page needs query at runtime, give it getInitialProps or getServerSideProps.","Prefer dynamic route params ([slug]) over query strings for static variations."],"tags":["static-export","pages-router","query-params","build"],"analyzedSha":"0ae8c72462952df163f1b1e0726641bc5b40dc93","analyzedAt":"2026-08-06T19:44:29.143Z","schemaVersion":2},"datasetVersion":"2026-08-07T02:17:10.218Z"}