vercel/next.js · error
Page "${page}" is missing exported function "generateStaticP
Error message
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 What it means
Thrown during static-path resolution in dev when output:'export' is set and an app-directory page does not export generateStaticParams. Static export requires every dynamic segment to be pre-rendered at build time, so Next.js needs the list of params; when prerenderedRoutes is undefined (no generateStaticParams exported), it throws. Triggered in getStaticPaths while coalescing static-path results.
Source
Thrown at packages/next/src/server/dev/next-dev-server.ts:889
return pathsResult
} finally {
// we don't re-use workers so destroy the used one
staticPathsWorker.end()
}
}
const result = this.staticPathsCache.get(pathname)
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'View on GitHub (pinned to 0ae8c72462)
Solutions
- Add an exported async generateStaticParams() to the dynamic page that returns all params to prerender.
- If the route should be fully static, provide the single param explicitly.
- Remove output:'export' if dynamic/on-demand rendering is actually needed.
- Ensure generateStaticParams returns an array of param objects covering every dynamic segment.
Example fix
// before: app/blog/[slug]/page.tsx with output:export, no params
export default function Page({ params }: { params: { slug: string } }) {
return <h1>{params.slug}</h1>
}
// after
export async function generateStaticParams() {
return [{ params: { slug: 'hello' } }, { params: { slug: 'world' } }]
}
export default function Page({ params }: { params: { slug: string } }) {
return <h1>{params.slug}</h1>
} Defensive patterns
Strategy: validation
Validate before calling
// Static-analysis guard: every dynamic app route needs generateStaticParams under output:export
import fs from 'fs'
import path from 'path'
function assertExportDynamicRoutesHaveGSP(appDir: string) {
for (const file of fs.readdirSync(appDir, { withFileTypes: true, recursive: true }) as any[]) {
if (file.isFile() && /\[.+\]/.test(file.parentPath || '') && /\.(tsx|ts|js|jsx)$/.test(file.name)) {
const src = fs.readFileSync(path.join(file.parentPath, file.name), 'utf8')
if (/export\s+default/.test(src) && !/generateStaticParams/.test(src)) {
throw new Error(`${file.name}: dynamic route missing generateStaticParams (output:export)`)
}
}
}
} Prevention
- When enabling output:'export', audit every app-router [param] route.
- Keep generateStaticParams in sync with your data source.
- Add a CI step that asserts all dynamic routes export params under export mode.
When it happens
Trigger: An app-router page (isAppPath true) under output:'export' has a dynamic route segment (e.g. app/blog/[slug]/page.tsx) but exports no generateStaticParams function. res.value.prerenderedRoutes is undefined, hitting the throw at line 889.
Common situations: Adding output:'export' to next.config while having dynamic app-router routes. Converting a pages-router project to app router and forgetting generateStaticParams. Newly adding a [param] route after enabling static export.
Related errors
- Page "${page}" is missing param "${pathname}" in "generateSt
- `unauthorized()` is experimental and only allowed to be used
- NEXT_EXPORT_ERROR
- Specified "i18n" cannot be used with "output: export". See m
- getStaticPaths with "fallback: blocking" cannot be used with
AI-assisted analysis of vercel/next.js@0ae8c72462 (2026-08-06).
Data as JSON: /api/errors/2e4d6755babf3783.
Report an issue: GitHub.