Report #104501
[bug\_fix] Error: Dynamic server usage: every path must be provided using \`generateStaticParams\` or \`fallback: false\` for static generation
For dynamic routes \(e.g., \`app/posts/\[id\]/page.js\`\) when using \`output: 'export'\` \(static export\) or \`generateStaticParams\` is required to list all possible paths. Add \`generateStaticParams\` that returns an array of params objects, or set \`dynamicParams = false\` in the page if you don't need fallback. The root cause is that Next.js cannot determine which dynamic paths to pre-render at build time.
Journey Context:
I was trying to build a static site with Next.js App Router. I had a blog with dynamic routes \`\[slug\]\`. When I ran \`next build\`, it failed with 'Error: Dynamic server usage: every path must be provided using \`generateStaticParams\`'. I hadn't defined \`generateStaticParams\` for that page. I thought Next.js would automatically fetch data and generate pages, but for static export every dynamic path must be enumerated. I added \`generateStaticParams\` that fetched all blog post slugs from my CMS and returned them. After that, the build succeeded. I also learned that if I wanted to allow fallback for new pages, I needed to use \`dynamicParams: true\` \(default\) and not use static export, or use \`fallback\` in older Pages Router.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-08-30T20:03:10.351845+00:00— report_created — created