Skip to content

fix(#56731): better error message for generateStaticParams#95388

Open
SukkaW wants to merge 1 commit into
vercel:canaryfrom
SukkaW:fix-56731
Open

fix(#56731): better error message for generateStaticParams#95388
SukkaW wants to merge 1 commit into
vercel:canaryfrom
SukkaW:fix-56731

Conversation

@SukkaW

@SukkaW SukkaW commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

The PR fixes #56731

Currently, invalid generateStaticParams is being treated as missing generateStaticParams, resulting in a misleading error message and bad DX.

The PR introduced better error messages for invalid generateStaticParams.

e2e tests added, documentation added and referenced.

expectedErrMsg: {
dev: 'Page "/another/[slug]/page" is missing param "/another/first" in "generateStaticParams()", which is required with "output: export" config. See more info here: https://nextjs.org/docs/messages/generate-static-params-export',
build:
'Page "/another/[slug]" has "generateStaticParams()" but it returned no params, so it cannot be used with "output: export" config. "generateStaticParams()" must return a non-empty array of params. See more info here: https://nextjs.org/docs/messages/generate-static-params-export',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it returned no params

Maybe it "returned an empty array [] with no params" for it to be clearly scannable?


describe('should error when generateStaticParams returns a non-array value', () => {
const expectedErrMsg =
'Invalid value returned from "generateStaticParams" in "/another/[slug]". Expected an array of params objects, received object.'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"params objects" is ambiguous (how do i know their shape), either inline example or link (or both) would help here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants