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()".
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
- Add
generateStaticParams()to the dynamic route file. - Return an array of params objects for every path you want generated.
- Re-run next build so each path is prerendered.
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.
export const dynamicParams = trueHow 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.