vercel/next.js · error

Specified i18n.locales contains the following duplicate…

Error message

Specified i18n.locales contains the following duplicate locales:\n${[...duplicateLocales].join(', ')}\nEach locale should be listed only once.\nSee more info here: https://nextjs.org/docs/messages/invalid-i18n-config

What it means

Error "Specified i18n.locales contains the following duplicate locales:\n${[...duplicateLocales].join(', ')}\nEach locale should be listed only once.\nSee more info here: https://nextjs.org/docs/messages/invalid-i18n-config" thrown in vercel/next.js.

Solutions

  1. Remove the duplicate locale entries from i18n.locales.
Defensive patterns

Strategy: validation

When it happens

Trigger: i18n.locales contains duplicate locale entries.

Common situations: The same locale listed twice in next.config i18n.locales.


AI-assisted analysis of vercel/next.js@34433fd12e (2026-08-19). Data as JSON: /api/errors/06d311104e6c6f1f. Report an issue: GitHub.

Appendix: source

Thrown at packages/next/src/server/config.ts:1401

    if (!i18n.locales.includes(i18n.defaultLocale)) {
      throw new Error(
        `Specified i18n.defaultLocale should be included in i18n.locales.\nSee more info here: https://nextjs.org/docs/messages/invalid-i18n-config`
      )
    }

    const normalizedLocales = new Set()
    const duplicateLocales = new Set()

    i18n.locales.forEach((locale) => {
      const localeLower = locale.toLowerCase()
      if (normalizedLocales.has(localeLower)) {
        duplicateLocales.add(locale)
      }
      normalizedLocales.add(localeLower)
    })

    if (duplicateLocales.size > 0) {
      throw new Error(
        `Specified i18n.locales contains the following duplicate locales:\n` +
          `${[...duplicateLocales].join(', ')}\n` +
          `Each locale should be listed only once.\n` +
          `See more info here: https://nextjs.org/docs/messages/invalid-i18n-config`
      )
    }

    // make sure default Locale is at the front
    i18n.locales = [
      i18n.defaultLocale,
      ...i18n.locales.filter((locale) => locale !== i18n.defaultLocale),
    ]

    const localeDetectionType = typeof i18n.localeDetection

    if (
      localeDetectionType !== 'boolean' &&
      localeDetectionType !== 'undefined'

View on GitHub (pinned to 34433fd12e)