{"record":{"id":"b0516cebbe1b0d64","repo":"vercel/next.js","slug":"specified-pageextensions-is-not-an-array-of-string","errorCode":null,"errorMessage":"Specified pageExtensions is not an array of strings, found \"${value}\". Please update this config or remove it.","messagePattern":"Specified pageExtensions is not an array of strings, found \"(.+?)\"\\. Please update this config or remove it\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/next/src/server/config.ts","lineNumber":369,"sourceCode":"        // don't allow public as the distDir as this is a reserved folder for\n        // public files\n        if (userDistDir === 'public') {\n          throw new Error(\n            `The 'public' directory is reserved in Next.js and can not be set as the 'distDir'. https://nextjs.org/docs/messages/can-not-output-to-public`\n          )\n        }\n        // make sure distDir isn't an empty string as it can result in the provided\n        // directory being deleted in development mode\n        if (userDistDir.length === 0) {\n          throw new Error(\n            `Invalid distDir provided, distDir can not be an empty string. Please remove this config or set it to undefined`\n          )\n        }\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      }","sourceCodeStart":351,"sourceCodeEnd":387,"githubUrl":"https://github.com/vercel/next.js/blob/0ae8c72462952df163f1b1e0726641bc5b40dc93/packages/next/src/server/config.ts#L351-L387","documentation":"The `pageExtensions` config must be an array. If a non-array value (string, number, object, null) is supplied, config normalization rejects it because the router iterates the array to match page files. The error message echoes the invalid value found.","triggerScenarios":"Setting `pageExtensions: 'tsx'` (string instead of array), `pageExtensions: null`, or `pageExtensions: { tsx: true }` in next.config.","commonSituations":"Assuming pageExtensions takes a single string. Copying an example that forgot the brackets. Mixing up with other config keys that accept a single string.","solutions":["Provide an array of strings: `pageExtensions: ['tsx', 'ts']`","Remove the pageExtensions key to restore the default `['tsx', 'ts', 'jsx', 'js']`"],"exampleFix":"// before\nmodule.exports = { pageExtensions: 'tsx' }\n// after\nmodule.exports = { pageExtensions: ['tsx'] }","handlingStrategy":"type-guard","validationCode":"if (!Array.isArray(pageExtensions)) {\n  throw new TypeError('pageExtensions must be an array')\n}","typeGuard":"const isStringArray = (v: unknown): v is string[] =>\n  Array.isArray(v) && v.length > 0 && v.every((e) => typeof e === 'string')","tryCatchPattern":null,"preventionTips":["Always use array literal syntax for pageExtensions","Type the config object against NextConfig so TS catches non-array values"],"tags":["config","routing","page-extensions"],"analyzedSha":"0ae8c72462952df163f1b1e0726641bc5b40dc93","analyzedAt":"2026-08-06T19:44:29.143Z","schemaVersion":2},"datasetVersion":"2026-08-07T02:17:10.218Z"}