{"record":{"id":"979666ecebf6fb3f","repo":"vercel/next.js","slug":"specified-pageextensions-is-not-an-array-of-string-979666","errorCode":null,"errorMessage":"Specified pageExtensions is not an array of strings, found \"${ext}\" of type \"${typeof ext}\". Please update this config or remove it.","messagePattern":"Specified pageExtensions is not an array of strings, found \"(.+?)\" of type \"(.+?)\"\\. Please update this config or remove it\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/next/src/server/config.ts","lineNumber":382,"sourceCode":"        }\n      }\n\n      if (key === 'pageExtensions') {\n        if (!Array.isArray(value)) {\n          throw new Error(\n            `Specified pageExtensions is not an array of strings, found \"${value}\". Please update this config or remove it.`\n          )\n        }\n\n        if (!value.length) {\n          throw new Error(\n            `Specified pageExtensions is an empty array. Please update it with the relevant extensions or remove it.`\n          )\n        }\n\n        value.forEach((ext) => {\n          if (typeof ext !== 'string') {\n            throw new Error(\n              `Specified pageExtensions is not an array of strings, found \"${ext}\" of type \"${typeof ext}\". Please update this config or remove it.`\n            )\n          }\n        })\n      }\n\n      const defaultValue = (defaultConfig as Record<string, unknown>)[key]\n\n      if (\n        !!value &&\n        value.constructor === Object &&\n        typeof defaultValue === 'object'\n      ) {\n        currentConfig[key] = {\n          ...defaultValue,\n          ...Object.keys(value).reduce<any>((c, k) => {\n            const v = value[k]\n            if (v !== undefined && v !== null) {","sourceCodeStart":364,"sourceCodeEnd":400,"githubUrl":"https://github.com/vercel/next.js/blob/0ae8c72462952df163f1b1e0726641bc5b40dc93/packages/next/src/server/config.ts#L364-L400","documentation":"Even when `pageExtensions` is a non-empty array, each element must be a string. If any element is a number, boolean, object, or null, normalization throws with the offending element and its typeof. This guards the router's string comparisons during file matching.","triggerScenarios":"Setting `pageExtensions: ['tsx', 123]`, `pageExtensions: ['ts', null]`, or `pageExtensions: ['js', true]`. Often from spreading mixed-type data into the array.","commonSituations":"Constructing extensions programmatically and accidentally including a non-string. Reading extensions from a JSON config that parsed numbers without quotes.","solutions":["Ensure every element is a string: cast or filter, e.g. `pageExtensions: exts.filter((e) => typeof e === 'string')`","Quote any numeric-looking extensions","Remove the key to use defaults"],"exampleFix":"// before\nmodule.exports = { pageExtensions: ['tsx', 123] }\n// after\nmodule.exports = { pageExtensions: ['tsx', '123'] }","handlingStrategy":"type-guard","validationCode":"pageExtensions = pageExtensions.filter((e) => typeof e === 'string')","typeGuard":"const isStringOnlyArray = (v: unknown): v is string[] =>\n  Array.isArray(v) && v.every((e) => typeof e === 'string')","tryCatchPattern":null,"preventionTips":["Filter mixed arrays before assignment: `.filter((e): e is string => typeof e === 'string')`","Quote any numeric-looking extensions in JSON config"],"tags":["config","routing","page-extensions","type-safety"],"analyzedSha":"0ae8c72462952df163f1b1e0726641bc5b40dc93","analyzedAt":"2026-08-06T19:44:29.143Z","schemaVersion":2},"datasetVersion":"2026-08-07T02:17:10.218Z"}