fix(#56731): better error message for generateStaticParams#95388
Open
SukkaW wants to merge 1 commit into
Open
Conversation
gaearon
reviewed
Jul 2, 2026
| 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', |
Contributor
There was a problem hiding this comment.
it returned no params
Maybe it "returned an empty array [] with no params" for it to be clearly scannable?
gaearon
reviewed
Jul 2, 2026
|
|
||
| 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.' |
Contributor
There was a problem hiding this comment.
"params objects" is ambiguous (how do i know their shape), either inline example or link (or both) would help here
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The PR fixes #56731
Currently, invalid
generateStaticParamsis being treated as missinggenerateStaticParams, 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.