{"record":{"id":"bf85ed7bdcd70524","repo":"vercel/next.js","slug":"specified-i18n-locales-should-be-an-array-received","errorCode":null,"errorMessage":"Specified i18n.locales should be an Array received ${typeof i18n.locales}.\nSee more info here: https://nextjs.org/docs/messages/invalid-i18n-config","messagePattern":"Specified i18n\\.locales should be an Array 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":1208,"sourceCode":"  }\n  // Ensure both properties are set to the same value\n  result.outputFileTracingRoot = rootDir\n  dset(result, ['turbopack', 'root'], rootDir)\n\n  setHttpClientAndAgentOptions(result || defaultConfig)\n\n  if (result.i18n) {\n    const { i18n } = result\n    const i18nType = typeof i18n\n\n    if (i18nType !== 'object') {\n      throw new Error(\n        `Specified i18n should be an object received ${i18nType}.\\nSee more info here: https://nextjs.org/docs/messages/invalid-i18n-config`\n      )\n    }\n\n    if (!Array.isArray(i18n.locales)) {\n      throw new Error(\n        `Specified i18n.locales should be an Array received ${typeof i18n.locales}.\\nSee more info here: https://nextjs.org/docs/messages/invalid-i18n-config`\n      )\n    }\n\n    if (i18n.locales.length > 100 && !silent) {\n      Log.warn(\n        `Received ${i18n.locales.length} i18n.locales items which exceeds the recommended max of 100.\\nSee more info here: https://nextjs.org/docs/advanced-features/i18n-routing#how-does-this-work-with-static-generation`\n      )\n    }\n\n    const defaultLocaleType = typeof i18n.defaultLocale\n\n    if (!i18n.defaultLocale || defaultLocaleType !== 'string') {\n      throw new Error(\n        `Specified i18n.defaultLocale should be a string.\\nSee more info here: https://nextjs.org/docs/messages/invalid-i18n-config`\n      )\n    }\n","sourceCodeStart":1190,"sourceCodeEnd":1226,"githubUrl":"https://github.com/vercel/next.js/blob/0ae8c72462952df163f1b1e0726641bc5b40dc93/packages/next/src/server/config.ts#L1190-L1226","documentation":"Thrown during Next.js config normalization when an `i18n` object is present but its `locales` field is not an Array. The validator (`Array.isArray`) runs early in the i18n block, before any locale-content checks, so a wrong-typed `locales` value aborts loading immediately. The error links to the invalid-i18n-config docs page.","triggerScenarios":"Setting `i18n: { locales: 'en-US' }` (a string), `i18n: { locales: { en: 'en-US' } }` (an object), `i18n: { locales: 42 }` (a number), or omitting the property entirely while still passing an `i18n` object triggers the `!Array.isArray(i18n.locales)` check at config.ts:1207.","commonSituations":"Developers migrating from a per-page i18n setup who write a single locale string instead of an array; copy-pasting locale config from a non-Next source; destructuring or spreading config that drops the array; TypeScript types being bypassed via `as any`.","solutions":["Set `i18n.locales` to an array of locale strings, e.g. `locales: ['en-US', 'nl-NL']`.","If you have a single locale, still wrap it in an array: `locales: ['en-US']`.","Check for accidental mutation/merging of the config object that replaces the array with a scalar before Next reads it.","Remove the entire `i18n` key if you are not using the Pages Router i18n routing (App Router does not use it)."],"exampleFix":"// before\nmodule.exports = { i18n: { locales: 'en-US', defaultLocale: 'en-US' } }\n// after\nmodule.exports = { i18n: { locales: ['en-US'], defaultLocale: 'en-US' } }","handlingStrategy":"type-guard","validationCode":"// Before exporting config, assert the shape\nconst i18n = { locales: ['en-US'], defaultLocale: 'en-US' };\nif (!Array.isArray(i18n.locales)) {\n  throw new Error('i18n.locales must be an array');\n}\nmodule.exports = { i18n };","typeGuard":"function isValidI18n(i18n: unknown): i18n is { locales: unknown[]; defaultLocale: string } {\n  return (\n    typeof i18n === 'object' && i18n !== null &&\n    Array.isArray((i18n as any).locales) &&\n    typeof (i18n as any).defaultLocale === 'string'\n  );\n}","tryCatchPattern":null,"preventionTips":["Use the official NextConfig TypeScript type so the compiler rejects non-array locales.","Validate dynamic/env-driven config with a type guard before exporting.","Keep locale lists in a single typed constant and reference it from the config."],"tags":["config","i18n","type-error"],"analyzedSha":"0ae8c72462952df163f1b1e0726641bc5b40dc93","analyzedAt":"2026-08-06T19:44:29.143Z","schemaVersion":2},"datasetVersion":"2026-08-07T02:17:10.218Z"}