vercel/next.js · error

getStaticPaths with "fallback: true" cannot be used with "ou

Error message

getStaticPaths with "fallback: true" cannot be used with "output: export". See more info here: https://nextjs.org/advanced-features/static-html-export

What it means

Thrown in dev under output:'export' when a pages-router page's getStaticPaths returns fallback:true. Static HTML export cannot serve a fallback shell rendered on demand (no runtime server), so fallback:true is incompatible with export. Detected when fallback === FallbackMode.PRERENDER.

Source

Thrown at packages/next/src/server/dev/next-dev-server.ts:910

            }

            if (
              !prerenderedRoutes.some((item) => item.pathname === urlPathname)
            ) {
              throw new Error(
                `Page "${page}" is missing param "${pathname}" in "generateStaticParams()", which is required with "output: export" config.`
              )
            }
          }
        }

        if (!isAppPath && this.nextConfig.output === 'export') {
          if (fallback === FallbackMode.BLOCKING_STATIC_RENDER) {
            throw new Error(
              'getStaticPaths with "fallback: blocking" cannot be used with "output: export". See more info here: https://nextjs.org/docs/advanced-features/static-html-export'
            )
          } else if (fallback === FallbackMode.PRERENDER) {
            throw new Error(
              'getStaticPaths with "fallback: true" cannot be used with "output: export". See more info here: https://nextjs.org/docs/advanced-features/static-html-export'
            )
          }
        }

        const value: {
          staticPaths: string[] | undefined
          prerenderedRoutes: PrerenderedRoute[] | undefined
          fallbackMode: FallbackMode | undefined
        } = {
          staticPaths: prerenderedRoutes?.map((route) => route.pathname),
          prerenderedRoutes,
          fallbackMode: fallback,
        }

        if (
          res.value?.fallbackMode !== undefined &&
          // This matches the hasGenerateStaticParams logic we do during build.

View on GitHub (pinned to 0ae8c72462)

Solutions

  1. Change getStaticPaths to `fallback: false` and enumerate all paths to prerender.
  2. Pre-render the full set of routes in getStaticPaths.paths.
  3. Drop output:'export' if on-demand fallback pages are genuinely needed.
  4. Search the repo for `fallback: true` across getStaticPaths and update each before exporting.

Example fix

// before
export async function getStaticPaths() {
  return { paths: [{ params: { id: '1' } }], fallback: true }
}

// after (static export compatible)
export async function getStaticPaths() {
  return { paths: [{ params: { id: '1' } }, { params: { id: '2' } }], fallback: false }
}
Defensive patterns

Strategy: validation

Validate before calling

// Forbid boolean-true fallback in pages-router under output:export
function checkGetStaticPathsForExport(paths: { fallback: string | boolean }) {
  if (paths.fallback === true) {
    throw new Error('getStaticPaths fallback:true is incompatible with output:"export"')
  }
}

Prevention

When it happens

Trigger: A pages-router page (isAppPath false) defines getStaticPaths with `fallback: true` while next.config has output:'export'. The fallback check at line 909 throws.

Common situations: Existing getStaticPaths using fallback:true (very common pattern) combined with a newly added output:'export'. Migrating a large site to static export without changing fallback strategies. Following a tutorial that used fallback:true then enabling export.

Related errors


AI-assisted analysis of vercel/next.js@0ae8c72462 (2026-08-06). Data as JSON: /api/errors/28ac9b18fb8158b0. Report an issue: GitHub.