vercel/next.js · error · Error

Page with dynamic = "error" encountered dynamic data method…

Error message

Page with dynamic = "error" encountered dynamic data method on ${path}.

What it means

Static-export strictness failure: the page segment was configured with dynamic = "error" (fully static), but the render touched a dynamic data API, giving cacheControl.revalidate === 0 with the isDynamicError flag set. next build --output-export therefore aborts for this path instead of producing a non-deterministic static file.

Solutions

  1. Remove dynamic = "error" from the page, or remove the dynamic data usage (cookies, headers, etc.) on that path.
Defensive patterns

Strategy: validation

When it happens

Trigger: A route with dynamic = "error" uses dynamic data during prerender.

Common situations: cookies()/headers()/fetch-no-store is used in a route forced to static with export const dynamic = 'error'.


AI-assisted analysis of vercel/next.js@0eb3775416 (2026-08-19). Data as JSON: /api/errors/d62a9048c6e9b55d. Report an issue: GitHub.

Appendix: source

Thrown at packages/next/src/export/routes/app-page.ts:118

      flightData,
      cacheControl = { revalidate: false, expire: undefined },
      postponed,
      fetchTags,
      fetchMetrics,
      segmentData,
      prefetchHints,
      renderResumeDataCache,
      hasPendingUi,
    } = metadata

    // Ensure we don't postpone without having PPR enabled.
    if (postponed && !renderOpts.experimental.isRoutePPREnabled) {
      throw new Error('Invariant: page postponed without PPR being enabled')
    }

    if (cacheControl.revalidate === 0) {
      if (isDynamicError) {
        throw new Error(
          `Page with dynamic = "error" encountered dynamic data method on ${path}.`
        )
      }
      const { staticBailoutInfo = {} } = metadata

      if (debugOutput && staticBailoutInfo?.description) {
        logDynamicUsageWarning({
          path,
          description: staticBailoutInfo.description,
          stack: staticBailoutInfo.stack,
        })
      }

      return { cacheControl, fetchMetrics }
    }

    // If page data isn't available, it means that the page couldn't be rendered
    // properly so long as we don't have unknown route params. When a route doesn't

View on GitHub (pinned to 0eb3775416)