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

Regression In I18n Domain-Based Locale Detection Incorrectly Overrides DefaultLocale On Main Domain

In Next.js 15.4+, when a locale is listed in the domains array of next.config, requests to the default domain for that locale incorrectly receive the domain's defaultLocale instead of the main defaultLocale. This causes wrong defaultLocale in getServerSideProps and next/link hrefs, leading to hydration errors.

highConfidence 85%Next.jsHydrationServer ActionsAffected V15.4.0Affected V15.5.0Affected V15.5.12

Origin Analysis

A change in domain locale detection logic in Next.js 15.4 likely matches the requested locale against the locales list of any domain in the domains array without verifying that the current host actually corresponds to that domain. This results in the defaultLocale being incorrectly derived from a domain's configuration even when serving from the default domain.
1. Create a Next.js project with i18n configured and a domains array containing at least one domain with a different defaultLocale.\n2. Upgrade to Next.js 15.5.x.\n3. On the default domain (e.g., localhost), navigate to a locale path that is listed in one of the domain's locales (e.g., /fr).\n4. Observe that defaultLocale from getServerSideProps args and router.defaultLocale are set to the domain's defaultLocale (e.g., fr) instead of the main defaultLocale (e.g., de).\n5. Note that next/link also adds the domain to href, causing hydration errors.

Fixing Code Block

Edge Case Audit

Downgrading to 15.3.4 may miss security and bug fixes introduced in later releases. Monitor the Next.js GitHub repository for an official fix and upgrade once available. If you cannot downgrade, consider disabling domain-based i18n routing or using custom middleware to manually set the locale cookie, but test thoroughly as this may introduce other issues.

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