{"record":{"id":"72bcc62c30a9efc4","repo":"vercel/next.js","slug":"specified-i18n-defaultlocale-should-be-included-in","errorCode":null,"errorMessage":"Specified i18n.defaultLocale should be included in i18n.locales.\nSee more info here: https://nextjs.org/docs/messages/invalid-i18n-config","messagePattern":"Specified i18n\\.defaultLocale should be included in i18n\\.locales\\.\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":1314,"sourceCode":"    }\n\n    const invalidLocales = i18n.locales.filter(\n      (locale: any) => typeof locale !== 'string'\n    )\n\n    if (invalidLocales.length > 0) {\n      throw new Error(\n        `Specified i18n.locales contains invalid values (${invalidLocales\n          .map(String)\n          .join(\n            ', '\n          )}), locales must be valid locale tags provided as strings e.g. \"en-US\".\\n` +\n          `See here for list of valid language sub-tags: http://www.iana.org/assignments/language-subtag-registry/language-subtag-registry`\n      )\n    }\n\n    if (!i18n.locales.includes(i18n.defaultLocale)) {\n      throw new Error(\n        `Specified i18n.defaultLocale should be included in i18n.locales.\\nSee more info here: https://nextjs.org/docs/messages/invalid-i18n-config`\n      )\n    }\n\n    const normalizedLocales = new Set()\n    const duplicateLocales = new Set()\n\n    i18n.locales.forEach((locale) => {\n      const localeLower = locale.toLowerCase()\n      if (normalizedLocales.has(localeLower)) {\n        duplicateLocales.add(locale)\n      }\n      normalizedLocales.add(localeLower)\n    })\n\n    if (duplicateLocales.size > 0) {\n      throw new Error(\n        `Specified i18n.locales contains the following duplicate locales:\\n` +","sourceCodeStart":1296,"sourceCodeEnd":1332,"githubUrl":"https://github.com/vercel/next.js/blob/0ae8c72462952df163f1b1e0726641bc5b40dc93/packages/next/src/server/config.ts#L1296-L1332","documentation":"Thrown at config.ts:1313 when `i18n.defaultLocale` is not a member of the `i18n.locales` array (`!i18n.locales.includes(i18n.defaultLocale)`). Next requires the default locale to be explicitly enumerated so it can resolve and promote it to the front of the list.","triggerScenarios":"`i18n: { locales: ['en-GB', 'fr'], defaultLocale: 'en-US' }` (default not in list); case mismatch such as `defaultLocale: 'en-us'` while locales contains `'en-US'` (the includes check is case-sensitive at this point).","commonSituations":"Renaming a locale in one place but not the other; using a region variant for the default that differs from the list; copying config and forgetting to add the default locale to the array.","solutions":["Add `defaultLocale` to the `locales` array exactly (same casing) as it is listed.","Standardize locale casing across both fields, e.g. always use `'en-US'`."],"exampleFix":"// before\ni18n: { locales: ['en-GB', 'fr'], defaultLocale: 'en-US' }\n// after\ni18n: { locales: ['en-US', 'en-GB', 'fr'], defaultLocale: 'en-US' }","handlingStrategy":"validation","validationCode":"if (!i18n.locales.includes(i18n.defaultLocale)) {\n  throw new Error('defaultLocale must be in locales');\n}","typeGuard":"function defaultInLocales(i18n: { locales: string[]; defaultLocale: string }): boolean {\n  return i18n.locales.includes(i18n.defaultLocale);\n}","tryCatchPattern":null,"preventionTips":["Keep a single source of truth for locales and derive the default from it.","Match casing exactly between defaultLocale and the locales array."],"tags":["config","i18n","validation"],"analyzedSha":"0ae8c72462952df163f1b1e0726641bc5b40dc93","analyzedAt":"2026-08-06T19:44:29.143Z","schemaVersion":2},"datasetVersion":"2026-08-07T02:17:10.218Z"}