nextjs - ✅(Solved) Fix Non-ASCII slugs in generateStaticParams() cause errors in both dev server and build when output: "export" is set [1 pull requests, 2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#92192Fetched 2026-04-08 02:01:49
View on GitHub
Comments
2
Participants
3
Timeline
8
Reactions
0
Timeline (top)
commented ×2labeled ×2cross-referenced ×1issue_type_added ×1

Error Message

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'

Root Cause

Why this happens (suspected root cause)

Fix Action

Fix / Workaround

Workaround: calling decodeURIComponent(slug) inside the page component resolves the module loading issue, but the dev server still logs the "missing param" error.

PR fix notes

PR #92194: fix: non-ASCII slugs with output: export and generateStaticParams

Description (problem / solution / changelog)

What?

  • Fix non-ASCII slugs with output: "export" + generateStaticParams.

Why?

  • Encoded URL params and raw generated params were mismatched.

How?

  • Match both encoded/decoded path variants in dev.
  • Use decoded app export path during render.
  • Add focused test coverage.

Fixes #92192

Changed files

  • packages/next/src/build/static-paths/utils.test.ts (modified, +35/-1)
  • packages/next/src/build/static-paths/utils.ts (modified, +27/-1)
  • packages/next/src/export/worker.ts (modified, +2/-1)
  • packages/next/src/server/dev/next-dev-server.ts (modified, +5/-2)

Code Example

Page "/[type]/[slug]/page" is missing param "/note/cli-환경에서-여러-명령어를-동시에-실행하기" in "generateStaticParams()", which is required with "output: export" config.

---

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'

---

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
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/minjongbaek/blog.minjong/tree/reproduce/non-ascii-slug-output-export

To Reproduce

  1. Clone the repo and checkout reproduce/non-ascii-slug-output-export
  2. Install dependencies and run the dev server (pnpm install && pnpm dev)
  3. Navigate to /note/dynamic-code-evaluation-not-allowed-in-edge-runtime (ASCII slug) — works fine
  4. Navigate to /note/cli-환경에서-여러-명령어를-동시에-실행하기 (non-ASCII slug)
  5. 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

extent analysis

TL;DR

Decode URL-encoded slugs in generateStaticParams() to match Next.js's dynamic route resolution.

Guidance

  • Verify that generateStaticParams() returns URL-encoded slugs by logging the output and comparing it to the expected raw slug.
  • Use decodeURIComponent(slug) to decode the URL-encoded slug inside generateStaticParams() to ensure consistency with Next.js's dynamic route resolution.
  • Test the dev server and build with the updated generateStaticParams() to confirm that the "missing param" error and MODULE_NOT_FOUND issue are resolved.
  • Consider adding a check to ensure that the decoded slug matches the expected raw slug to prevent potential issues with non-ASCII characters.

Example

// In generateStaticParams()
const decodedSlug = decodeURIComponent(slug);
// Use decodedSlug for further processing

Notes

The provided workaround of calling decodeURIComponent(slug) inside the page component resolves the module loading issue, but the dev server still logs the "missing param" error. Decoding the slug in generateStaticParams() should resolve both issues.

Recommendation

Apply the workaround by decoding the URL-encoded slug in generateStaticParams() to ensure consistency with Next.js's dynamic route resolution. This should resolve the "missing param" error and MODULE_NOT_FOUND issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING