vercel/next.js · error · Error

Specified i18n.locales should be an Array received

Error message

Specified i18n.locales should be an Array received ${typeof i18n.locales}.
See more info here: https://nextjs.org/docs/messages/invalid-i18n-config

What it means

i18n config validation in assignDefaultsAndValidate: the i18n object is present and an object, but i18n.locales fails Array.isArray — it is not an array. locales must be a list of locale-tag strings; the received type is echoed with a link to the i18n config docs.

Solutions

  1. Set i18n.locales to an array of locale strings.
Defensive patterns

Strategy: validation

When it happens

Trigger: i18n.locales is not an array.

Common situations: Setting i18n.locales to a string or object in next.config.


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

Appendix: source

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

  }
  // Ensure both properties are set to the same value
  result.outputFileTracingRoot = rootDir
  dset(result, ['turbopack', 'root'], rootDir)

  setHttpClientAndAgentOptions(result || defaultConfig)

  if (result.i18n) {
    const { i18n } = result
    const i18nType = typeof i18n

    if (i18nType !== 'object') {
      throw new Error(
        `Specified i18n should be an object received ${i18nType}.\nSee more info here: https://nextjs.org/docs/messages/invalid-i18n-config`
      )
    }

    if (!Array.isArray(i18n.locales)) {
      throw new Error(
        `Specified i18n.locales should be an Array received ${typeof i18n.locales}.\nSee more info here: https://nextjs.org/docs/messages/invalid-i18n-config`
      )
    }

    if (i18n.locales.length > 100 && !silent) {
      Log.warn(
        `Received ${i18n.locales.length} i18n.locales items which exceeds the recommended max of 100.\nSee more info here: https://nextjs.org/docs/advanced-features/i18n-routing#how-does-this-work-with-static-generation`
      )
    }

    const defaultLocaleType = typeof i18n.defaultLocale

    if (!i18n.defaultLocale || defaultLocaleType !== 'string') {
      throw new Error(
        `Specified i18n.defaultLocale should be a string.\nSee more info here: https://nextjs.org/docs/messages/invalid-i18n-config`
      )
    }

View on GitHub (pinned to 34433fd12e)