Report #17724
[bug\_fix] generateStaticParams is required for dynamic routes during static export
Export an async function \`generateStaticParams\` from the dynamic route file that returns an array of objects representing the possible parameter values. Root cause: Next.js cannot know at build time what values a dynamic route segment \(e.g., \`\[id\]\`\) can take unless explicitly told; for static export or SSG, these must be enumerated.
Journey Context:
You create \`app/blog/\[slug\]/page.tsx\`. You run \`next build\` for static export. The build fails with 'generateStaticParams is required'. You initially think dynamic routes just work, but realize that for static HTML generation, Next.js needs to know every possible URL slug to create a file for. You add \`export async function generateStaticParams\(\) \{ return \[\{ slug: 'hello' \}, \{ slug: 'world' \}\]; \}\`. The build succeeds because Next.js now generates \`blog/hello/index.html\` and \`blog/world/index.html\` at build time.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T06:14:33.493796+00:00— report_created — created