AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

Regression: Inconsistent URL Decoding Of Await Params Between Page And GenerateMetadata

Next.js 16.2.0-canary.54 introduced a regression where `await params` returns URL-encoded values in the page component but decoded values in generateMetadata, causing inconsistent behavior for dynamic routes with encoded characters (e.g., %20).

highConfidence 85%NextTurbopackReact Server ComponentsPages RouterAffected V>=16.2.0-Canary.54 <16.3.0-Preview.6

Origin Analysis

The regression was likely introduced by PR #90249, which changed the decoding of route params in the generateMetadata context but did not apply the same decoding to the page component's params. This leads to a split path where params are decoded in one entry point (generateMetadata) but left encoded in another (default export).
1. Create a Next.js dynamic route at /products/[productId] with a page that logs `const { productId } = await params` in both the default export and generateMetadata. 2. Navigate to /products/foo%20bar. 3. Observe server logs: page shows raw "foo%20bar" (char codes 102,111,111,37,50,48,98,97,114) while generateMetadata shows decoded "foo bar" (char codes 102,111,111,32,98,97,114).

Fixing Code Block

Edge Case Audit

Applying `decodeURIComponent` globally may affect existing code that expects raw encoded params (e.g., if users pre-decode or rely on the raw format for custom parsing). It may also cause double-decoding if some params are already decoded by another layer, potentially corrupting values containing literal '%' sequences (e.g., '100%25'). Rollback: if this fix introduces regressions, revert to the previous behavior by removing the decoding from the unified function and instead decoding only in generateMetadata to match the page's raw behavior, or vice versa. Thorough testing across all dynamic route scenarios is required.

Ecosystem Topology

Agent Frameworks

LangChain, LlamaIndex, and Pydantic

  1. highProperty graph relation keys collide when entity IDs or labels contain underscores
  2. highCodeActAgent drops assistant tool-call metadata during handoff, leaving an orphan tool response
  3. high[Bug]: HierarchicalNodeParser async methods return the documents unsplit
  4. highLLM.predict_and_call fails with ValidationError for non-function-calling models when react_chat_formatter is omitted
  5. highAnthropic streaming server-tool input_json_delta overwrites completed client tool_use arguments due to stale cur_tool_call state