vercel/next.js · error

Specified i18n.localeDetection should be undefined or a…

Error message

Specified i18n.localeDetection should be undefined or a boolean received ${localeDetectionType}.\nSee more info here: https://nextjs.org/docs/messages/invalid-i18n-config

What it means

Error "Specified i18n.localeDetection should be undefined or a boolean received ${localeDetectionType}.\nSee more info here: https://nextjs.org/docs/messages/invalid-i18n-config" thrown in vercel/next.js.

Solutions

  1. Set i18n.localeDetection to a boolean or remove it.
Defensive patterns

Strategy: validation

When it happens

Trigger: i18n.localeDetection is neither undefined nor a boolean.

Common situations: A string or number assigned to i18n.localeDetection in next.config.


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

Appendix: source

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

          `${[...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'
    ) {
      throw new Error(
        `Specified i18n.localeDetection should be undefined or a boolean received ${localeDetectionType}.\nSee more info here: https://nextjs.org/docs/messages/invalid-i18n-config`
      )
    }
  }

  if (result.devIndicators !== false && result.devIndicators?.position) {
    const { position } = result.devIndicators
    const allowedValues = [
      'top-left',
      'top-right',
      'bottom-left',
      'bottom-right',
    ]

    if (!allowedValues.includes(position)) {
      throw new Error(
        `Invalid "devIndicator.position" provided, expected one of ${allowedValues.join(
          ', '

View on GitHub (pinned to 34433fd12e)