vercel/next.js · error · Error

Invariant: PPR cannot be enabled in export mode

Error message

Invariant: PPR cannot be enabled in export mode

What it means

Invariant thrown in exportAppImpl at the end of a static export: cacheComponents (PPR) is enabled in the config while running next export in non-build-export mode. Static export emits fully static outputs that are incompatible with PPR's partial prerender responses, so the combination is refused outright rather than producing broken output.

Source

Thrown at packages/next/src/export/index.ts:906

      // Update not found.
      if (result.ssgNotFound === true) {
        collector.ssgNotFoundPaths.add(path)
      }

      // Update durations.
      const durations = collector.byPage.get(page) ?? {
        durationsByPath: new Map<string, number>(),
      }
      durations.durationsByPath.set(path, result.duration)
      collector.byPage.set(page, durations)
    }
  }

  // Export mode provide static outputs that are not compatible with PPR mode.
  if (!options.buildExport && nextConfig.cacheComponents) {
    // TODO: add message
    throw new Error('Invariant: PPR cannot be enabled in export mode')
  }

  // copy prerendered routes to outDir
  if (!options.buildExport && prerenderManifest) {
    await Promise.all(
      Object.keys(prerenderManifest.routes).map(async (unnormalizedRoute) => {
        // Special handling: map app /_not-found to 404.html (and 404/index.html when trailingSlash)
        if (unnormalizedRoute === '/_not-found') {
          const { srcRoute } = prerenderManifest!.routes[unnormalizedRoute]
          const appPageName = mapAppRouteToPage.get(srcRoute || '')
          const pageName = appPageName || srcRoute || unnormalizedRoute
          const isAppPath = Boolean(appPageName)
          const route = normalizePagePath(unnormalizedRoute)

          const pagePath = getPagePath(pageName, distDir, undefined, isAppPath)
          const distPagesDir = join(
            pagePath,
            pageName

View on GitHub (pinned to 258b1c1bc0)

Solutions

  1. Disable PPR (experimental.ppr / cacheComponents) when using output: export.
Defensive patterns

Strategy: validation

When it happens

Trigger: PPR is enabled while running in export mode.

Common situations: experimental ppr/cacheComponents combined with output: export, an unsupported invariant state.


AI-assisted analysis of vercel/next.js@258b1c1bc0 (2026-08-19). Data as JSON: /api/errors/69106ba5a678a733. Report an issue: GitHub.