{"record":{"id":"1ba0298eb9f5c2ba","repo":"vercel/next.js","slug":"specified-i18n-locales-must-be-an-array-of-locale","errorCode":null,"errorMessage":"Specified i18n.locales must be an array of locale strings e.g. [\"en-US\", \"nl-NL\"] received ${typeof i18n.locales}.\nSee more info here: https://nextjs.org/docs/messages/invalid-i18n-config","messagePattern":"Specified i18n\\.locales must be an array of locale strings e\\.g\\. \\[\"en-US\", \"nl-NL\"\\] 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":1293,"sourceCode":"          }\n        }\n\n        return hasInvalidLocale\n      })\n\n      if (invalidDomainItems.length > 0) {\n        throw new Error(\n          `Invalid i18n.domains values:\\n${invalidDomainItems\n            .map((item: any) => JSON.stringify(item))\n            .join(\n              '\\n'\n            )}\\n\\ndomains value must follow format { domain: 'example.fr', defaultLocale: 'fr', locales: ['fr'] }.\\nSee more info here: https://nextjs.org/docs/messages/invalid-i18n-config`\n        )\n      }\n    }\n\n    if (!Array.isArray(i18n.locales)) {\n      throw new Error(\n        `Specified i18n.locales must be an array of locale strings e.g. [\"en-US\", \"nl-NL\"] received ${typeof i18n.locales}.\\nSee more info here: https://nextjs.org/docs/messages/invalid-i18n-config`\n      )\n    }\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    }","sourceCodeStart":1275,"sourceCodeEnd":1311,"githubUrl":"https://github.com/vercel/next.js/blob/0ae8c72462952df163f1b1e0726641bc5b40dc93/packages/next/src/server/config.ts#L1275-L1311","documentation":"A redundant defensive re-check at config.ts:1292 that `i18n.locales` is still an array, after the domains-validation block has run. Because the identical `!Array.isArray` check at line 1207 already guards entry into the i18n block and the block never reassigns `locales` before this point, this branch is effectively unreachable in normal flow. The message differs slightly ('must be an array of locale strings').","triggerScenarios":"In standard Next.js loading this is unreachable because line 1207 throws first for a non-array `locales`. It could only fire if a custom plugin or middleware mutated `i18n.locales` to a non-array between the two checks, which the core code does not do.","commonSituations":"Essentially never seen in practice; if you encounter it, suspect a config plugin or monkey-patch that mutates the `i18n` object during normalization.","solutions":["Treat this identically to error 200: ensure `i18n.locales` is an array of strings.","Audit any custom config plugins or `require()`-time mutations of the config object that run during normalization."],"exampleFix":"// before\ni18n: { locales: 'en-US', defaultLocale: 'en-US' }\n// after\ni18n: { locales: ['en-US'], defaultLocale: 'en-US' }","handlingStrategy":"type-guard","validationCode":"// Same as 200 — this branch is defensively redundant.\nif (!Array.isArray(i18n.locales)) throw new Error('locales must be array');","typeGuard":"const isLocaleArray = (i18n: any): i18n is { locales: string[] } =>\n  Array.isArray(i18n?.locales);","tryCatchPattern":null,"preventionTips":["Treat identically to error 200.","Avoid plugins that mutate `i18n.locales` mid-normalization."],"tags":["config","i18n","dead-code","type-error"],"analyzedSha":"0ae8c72462952df163f1b1e0726641bc5b40dc93","analyzedAt":"2026-08-06T19:44:29.143Z","schemaVersion":2},"datasetVersion":"2026-08-07T02:17:10.218Z"}