vercel/next.js · error
Specified i18n.defaultLocale should be included in i18n.loca
Error message
Specified i18n.defaultLocale should be included in i18n.locales. See more info here: https://nextjs.org/docs/messages/invalid-i18n-config
What it means
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.
Source
Thrown at packages/next/src/server/config.ts:1314
}
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 0ae8c72462)
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'`.
Example fix
// before
i18n: { locales: ['en-GB', 'fr'], defaultLocale: 'en-US' }
// after
i18n: { locales: ['en-US', 'en-GB', 'fr'], defaultLocale: 'en-US' } Defensive patterns
Strategy: validation
Validate before calling
if (!i18n.locales.includes(i18n.defaultLocale)) {
throw new Error('defaultLocale must be in locales');
} Type guard
function defaultInLocales(i18n: { locales: string[]; defaultLocale: string }): boolean {
return i18n.locales.includes(i18n.defaultLocale);
} Prevention
- Keep a single source of truth for locales and derive the default from it.
- Match casing exactly between defaultLocale and the locales array.
When it happens
Trigger: `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).
Common situations: 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.
Related errors
- Invalid i18n.domains values: ${invalidDomainItems.map((item:
- Specified i18n.locales contains invalid values (${invalidLoc
- Specified i18n.locales contains the following duplicate loca
- Specified "i18n" cannot be used with "output: export". See m
- Specified basePath has to start with a /, found "${result.ba
AI-assisted analysis of vercel/next.js@0ae8c72462 (2026-08-06).
Data as JSON: /api/errors/72bcc62c30a9efc4.
Report an issue: GitHub.