Skip to content

Regression: await params behaviour differs when called from generateMetadata vs default function #95343

Description

@ctolkien

Link to the code that reproduces this issue

https://github.com/ctolkien/next-route-params-issue

To Reproduce

Browse to /products/foo%20bar

This code is running const { productId } = await params; in both the default export function as well as the generateMetaData function. Observe in the server logs that there are differences in what decoding has taken place:

[Page] raw productId: "foo%20bar"
[Page] char codes: [
  102, 111, 111, 37,
   50,  48,  98, 97,
  114
]
[generateMetadata] raw productId: "foo bar"
[generateMetadata] char codes: [
  102, 111, 111, 32,
   98,  97, 114
]

The generateMetadata version has been url decoded, where as the one in another function has not.

This was introduced in 16.2.0-canary.54, seemingly by #90249. I do not think the change of behaviour was intentional.

Current vs. Expected behavior

The results of await params should be consistent.

Provide environment information

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Enterprise
  Available memory (MB): 65422
  Available CPU cores: 16
Binaries:
  Node: 24.13.1
  npm: 11.8.0
  Yarn: N/A
  pnpm: 11.9.0
Relevant Packages:
  next: 16.3.0-preview.5 // Latest available version is detected (16.3.0-preview.5).
  eslint-config-next: N/A
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 5.9.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Dynamic Routes

Which stage(s) are affected? (Select all that apply)

next dev (local), Other (Deployed)

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions