vercel/next.js · error

Specified i18n.defaultLocale should be included in…

Error message

Specified i18n.defaultLocale should be included in i18n.locales.\nSee more info here: https://nextjs.org/docs/messages/invalid-i18n-config

What it means

i18n config validation in assignDefaultsAndValidate: after the locales array passed element checks, the membership test i18n.locales.includes(i18n.defaultLocale) failed — the configured default locale is not one of the listed locales. Requests would never resolve to it, so validation rejects the config.

Solutions

  1. Add the defaultLocale value to the i18n.locales array.
Defensive patterns

Strategy: validation

When it happens

Trigger: i18n.defaultLocale is not present in i18n.locales.

Common situations: defaultLocale omitted from the locales array in next.config i18n.


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

Appendix: source

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

    }

    const invalidLocales = i18n.locales.filter(
      (locale: any) => typeof locale !== 'string'
    )

    if (invalidLocales.length > 0) {
      throw new Error(
        `Specified i18n.locales contains invalid values (${invalidLocales
          .map(String)
          .join(
            ', '
          )}), locales must be valid locale tags provided as strings e.g. "en-US".\n` +
          `See here for list of valid language sub-tags: http://www.iana.org/assignments/language-subtag-registry/language-subtag-registry`
      )
    }

    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` +

View on GitHub (pinned to 34433fd12e)