vercel/next.js · error

Page "${page}" is missing param "${pathname}" in "generateSt

Error message

Page "${page}" is missing param "${pathname}" in "generateStaticParams()", which is required with "output: export" config.

What it means

Thrown in dev under output:'export' when an app-router page exports generateStaticParams but the specific requested pathname is not among the prerendered routes it returned. Static export can only serve pre-rendered paths, so a request (or build resolution) for a missing param fails. The check is `!prerenderedRoutes.some(item => item.pathname === urlPathname)`.

Source

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

    const nextInvoke = withCoalescedInvoke(__getStaticPaths)(
      `staticPaths-${pathname}`,
      []
    )
      .then(async (res) => {
        const { prerenderedRoutes, fallbackMode: fallback } = res.value

        if (isAppPath) {
          if (this.nextConfig.output === 'export') {
            if (!prerenderedRoutes) {
              throw new Error(
                `Page "${page}" is missing exported function "generateStaticParams()", which is required with "output: export" config. See more info here: https://nextjs.org/docs/messages/generate-static-params`
              )
            }

            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'
            )
          }
        }

View on GitHub (pinned to 0ae8c72462)

Solutions

  1. Add the missing param value to the array returned by generateStaticParams.
  2. Generate params dynamically from the same data source the links use so they stay in sync.
  3. Fix or remove links that point to params not covered by the export.
  4. If arbitrary slugs are needed, reconsider output:'export' (static export cannot do on-demand rendering).

Example fix

// before: missing the requested slug
export async function generateStaticParams() {
  return [{ params: { slug: 'hello' } }]
}

// after: include all referenced slugs
export async function generateStaticParams() {
  return [{ params: { slug: 'hello' } }, { params: { slug: 'world' } }]
}
Defensive patterns

Strategy: validation

Validate before calling

// Ensure links only reference params covered by generateStaticParams
function assertParamsCovered(generated: string[], referenced: string[]) {
  const set = new Set(generated)
  for (const p of referenced) {
    if (!set.has(p)) throw new Error(`param '${p}' not returned by generateStaticParams (output:export)`)
  }
}

Prevention

When it happens

Trigger: generateStaticParams returns [{slug:'a'}] but a request/build path resolves to /b (slug='b'), which is not in the list. The pathname named in the error is missing from the returned params.

Common situations: generateStaticParams returns a finite list but the app expects arbitrary slugs. Data source changed so fewer params are returned than the routes referenced. Hardcoded params that don't match actual content. Links pointing to params not covered by generateStaticParams.

Related errors


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