Skip to content
Latchkey

Next.js "Page is missing exported function generateStaticParams()" in CI

With a fully static export (output: 'export') or a route configured for static generation, a dynamic segment like [slug] must enumerate its values through generateStaticParams(). Without it, the build has no paths to render and fails.

What this error means

next build fails with "Page '/blog/[slug]' is missing exported function generateStaticParams()" or "Page '/blog/[slug]' is missing param '/blog/x' in generateStaticParams()".

next build
Error: Page "/blog/[slug]" is missing "generateStaticParams()" so it cannot
be used with "output: export" config.

Common causes

A dynamic route under static export has no params source

output: 'export' produces fully static HTML, so every dynamic path must be known at build time via generateStaticParams.

generateStaticParams omits paths that are linked

The function returns some slugs but not all that the app references, so a requested path has no generated page.

How to fix it

Export generateStaticParams for the segment

  1. Add generateStaticParams() to the dynamic route file.
  2. Return an array of params objects for every path you want generated.
  3. Re-run next build so each path is prerendered.
app/blog/[slug]/page.tsx
export async function generateStaticParams() {
  const posts = await getPosts()
  return posts.map((p) => ({ slug: p.slug }))
}

Allow on-demand paths if not exporting

If you are not using static export, allow params outside the list to render on demand.

app/blog/[slug]/page.tsx
export const dynamicParams = true

How to prevent it

  • Pair every dynamic segment under static export with generateStaticParams.
  • Return all linked slugs so no path is missing.
  • Decide on static export vs on-demand rendering up front.

Frequently asked questions

What causes ""missing param ... generateStaticParams""?
output: 'export' produces fully static HTML, so every dynamic path must be known at build time via generateStaticParams.
How do I fix "missing param ... generateStaticParams"?
Export generateStaticParams for the segment

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card