Non-ASCII slugs in generateStaticParams() cause errors in both dev server and build when output: "export" is set
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 142k
- Forks
- 32.5k
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 351
Description
Link to the code that reproduces this issue
https://github.com/minjongbaek/blog.minjong/tree/reproduce/non-ascii-slug-output-export
To Reproduce
- Clone the repo and checkout
reproduce/non-ascii-slug-output-export - Install dependencies and run the dev server (
pnpm install && pnpm dev) - Navigate to
/note/dynamic-code-evaluation-not-allowed-in-edge-runtime(ASCII slug) — works fine - Navigate to
/note/cli-환경에서-여러-명령어를-동시에-실행하기(non-ASCII slug) - Observe the error below
Current vs. Expected behavior
Current:
Dev server:
Page "/[type]/[slug]/page" is missing param "/note/cli-환경에서-여러-명령어를-동시에-실행하기" in "generateStaticParams()", which is required with "output: export" config.
Build (next build):
Error occurred prerendering page "/note/cli-환경에서-여러-명령어를-동시에-실행하기".
Error: Cannot find module './note/cli-%ED%99%98%EA%B2%BD%EC%97%90%EC%84%9C-%EC%97%AC%EB%9F%AC-%EB%AA%85%EB%A0%B9%EC%96%B4%EB%A5%BC-%EB%8F%99%EC%8B%9C%EC%97%90-%EC%8B%A4%ED%96%89%ED%95%98%EA%B8%B0/index.mdx'
Expected: Both dev server and build should handle non-ASCII slugs returned from generateStaticParams() without errors, just like ASCII slugs.
Why this happens (suspected root cause)
generateStaticParams() returns raw non-ASCII slugs (e.g. cli-환경에서-여러-명령어를-동시에-실행하기), but Next.js URL-encodes them when resolving dynamic routes. This causes a mismatch in two places:
- Dev server: compares the URL-encoded param against the raw slug → "missing param" error
- Build: tries to load the MDX module using the URL-encoded path →
MODULE_NOT_FOUND
Workaround: calling decodeURIComponent(slug) inside the page component resolves the module loading issue, but the dev server still logs the "missing param" error.
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 25.3.0: Wed Jan 28 20:53:15 PST 2026; root:xnu-12377.81.4~5/RELEASE_ARM64_T6000
Available memory (MB): 16384
Available CPU cores: 8
Binaries:
Node: 22.14.0
npm: 10.9.2
Yarn: N/A
pnpm: 10.13.1
Relevant Packages:
next: 16.2.1-canary.16 // Latest available version is detected (16.2.1-canary.16).
eslint-config-next: N/A
react: 19.0.0
react-dom: 19.0.0
typescript: 5.8.2
Next.js Config:
output: export
Which area(s) are affected? (Select all that apply)
Output, Dynamic Routes
Which stage(s) are affected? (Select all that apply)
next dev (local), next build (local)
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by cloning the linked reproduction and checking out reproduce/non-ascii-slug-output-export, then run pnpm install && pnpm dev and the build command to reproduce both failures. Trace output: export handling for dynamic routes and generateStaticParams(), then verify that the non-ASCII slug works in both development and build without the reported errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nextjs, react
- Domain
- build-system, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100