nextjs build_error ai_generated true

Error: Page is missing generateStaticParams()

ID: nextjs/generatestaticparams-error

Also available as: JSON · Markdown
92%Fix Rate
92%Confidence
50Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
14 active

Root Cause

Dynamic route with output: 'export' requires generateStaticParams to know all possible paths.

generic

Workarounds

  1. 95% success Add generateStaticParams to return all possible params
    export async function generateStaticParams() {
      const posts = await getPosts();
      return posts.map(p => ({ slug: p.slug }));
    }

    Sources: https://nextjs.org/docs/app/api-reference/functions/generate-static-params

  2. 88% success Use dynamicParams = false to return 404 for unknown params, or true (default) for ISR
    Use dynamicParams = false to return 404 for unknown params, or true (default) for ISR

    Sources: https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#dynamicparams

Dead Ends

Common approaches that don't work:

  1. Remove the dynamic route segment 80% fail

    You need the dynamic route — removing it changes the URL structure

  2. Set output: 'standalone' to avoid static generation 60% fail

    Changes deployment model entirely

Error Chain

Frequently confused with: