{"record":{"id":"15b025d90391154d","repo":"vercel/next.js","slug":"specified-i18n-localedetection-should-be-undefined","errorCode":null,"errorMessage":"Specified i18n.localeDetection should be undefined or a boolean received ${localeDetectionType}.\nSee more info here: https://nextjs.org/docs/messages/invalid-i18n-config","messagePattern":"Specified i18n\\.localeDetection should be undefined or a boolean received (.+?)\\.\nSee more info here: https://nextjs\\.org/docs/messages/invalid-i18n-config","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/next/src/server/config.ts","lineNumber":1351,"sourceCode":"          `${[...duplicateLocales].join(', ')}\\n` +\n          `Each locale should be listed only once.\\n` +\n          `See more info here: https://nextjs.org/docs/messages/invalid-i18n-config`\n      )\n    }\n\n    // make sure default Locale is at the front\n    i18n.locales = [\n      i18n.defaultLocale,\n      ...i18n.locales.filter((locale) => locale !== i18n.defaultLocale),\n    ]\n\n    const localeDetectionType = typeof i18n.localeDetection\n\n    if (\n      localeDetectionType !== 'boolean' &&\n      localeDetectionType !== 'undefined'\n    ) {\n      throw new Error(\n        `Specified i18n.localeDetection should be undefined or a boolean received ${localeDetectionType}.\\nSee more info here: https://nextjs.org/docs/messages/invalid-i18n-config`\n      )\n    }\n  }\n\n  if (result.devIndicators !== false && result.devIndicators?.position) {\n    const { position } = result.devIndicators\n    const allowedValues = [\n      'top-left',\n      'top-right',\n      'bottom-left',\n      'bottom-right',\n    ]\n\n    if (!allowedValues.includes(position)) {\n      throw new Error(\n        `Invalid \"devIndicator.position\" provided, expected one of ${allowedValues.join(\n          ', '","sourceCodeStart":1333,"sourceCodeEnd":1369,"githubUrl":"https://github.com/vercel/next.js/blob/0ae8c72462952df163f1b1e0726641bc5b40dc93/packages/next/src/server/config.ts#L1333-L1369","documentation":"Thrown at config.ts:1351 when `i18n.localeDetection` is defined but is neither a boolean nor undefined. `localeDetection` controls automatic Accept-Header-based locale redirection; only `true`/`false`/omitted are valid.","triggerScenarios":"`i18n: { localeDetection: 'false' }` (string), `localeDetection: 0`, `localeDetection: null` is allowed (typeof null === 'object', which fails), `localeDetection: 'yes'`.","commonSituations":"Setting the value from an env var without coercing to a boolean (`process.env.DISABLE_LOCALE_DETECTION` is a string); copy-pasting config examples that quote the boolean.","solutions":["Use a real boolean: `localeDetection: false`, or omit the key entirely.","When sourcing from env, coerce explicitly: `localeDetection: process.env.DISABLE !== '1'`."],"exampleFix":"// before\ni18n: { locales: ['en-US'], defaultLocale: 'en-US', localeDetection: 'false' }\n// after\ni18n: { locales: ['en-US'], defaultLocale: 'en-US', localeDetection: false }","handlingStrategy":"type-guard","validationCode":"if (i18n.localeDetection !== undefined && typeof i18n.localeDetection !== 'boolean') {\n  throw new Error('localeDetection must be boolean or undefined');\n}","typeGuard":"function validLocaleDetection(i18n: any): boolean {\n  return i18n.localeDetection === undefined || typeof i18n.localeDetection === 'boolean';\n}","tryCatchPattern":null,"preventionTips":["Coerce env-driven values to booleans explicitly.","Omit the key rather than passing a string if you accept the default."],"tags":["config","i18n","type-error"],"analyzedSha":"0ae8c72462952df163f1b1e0726641bc5b40dc93","analyzedAt":"2026-08-06T19:44:29.143Z","schemaVersion":2},"datasetVersion":"2026-08-07T02:17:10.218Z"}