{"record":{"id":"6198968fbdfa38f5","repo":"vercel/next.js","slug":"specified-pageextensions-is-an-empty-array-please","errorCode":null,"errorMessage":"Specified pageExtensions is an empty array. Please update it with the relevant extensions or remove it.","messagePattern":"Specified pageExtensions is an empty array\\. Please update it with the relevant extensions or remove it\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/next/src/server/config.ts","lineNumber":375,"sourceCode":"        }\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      }\n\n      const defaultValue = (defaultConfig as Record<string, unknown>)[key]\n\n      if (\n        !!value &&\n        value.constructor === Object &&","sourceCodeStart":357,"sourceCodeEnd":393,"githubUrl":"https://github.com/vercel/next.js/blob/0ae8c72462952df163f1b1e0726641bc5b40dc93/packages/next/src/server/config.ts#L357-L393","documentation":"An empty `pageExtensions` array is rejected because the router would then match zero page files, breaking all routes. Unlike the type error, the value is a valid array but contains no extensions to look for.","triggerScenarios":"Setting `pageExtensions: []` in next.config.","commonSituations":"Building the array dynamically from a variable that ends up empty. Conditionally spreading extensions that all resolve to false. Clearing the array intending to 'reset' to defaults.","solutions":["Populate the array with the extensions you use, e.g. `pageExtensions: ['tsx', 'ts', 'jsx', 'js']`","Remove the pageExtensions key to use the default"],"exampleFix":"// before\nmodule.exports = { pageExtensions: [] }\n// after\nmodule.exports = { pageExtensions: ['tsx', 'ts'] }","handlingStrategy":"validation","validationCode":"if (Array.isArray(pageExtensions) && pageExtensions.length === 0) {\n  pageExtensions = ['tsx', 'ts', 'jsx', 'js']\n}","typeGuard":"const isNonEmptyStringArray = (v: unknown): v is string[] =>\n  Array.isArray(v) && v.every((e) => typeof e === 'string') && v.length > 0","tryCatchPattern":null,"preventionTips":["Guard dynamically-built extension arrays with a fallback default","Don't set pageExtensions to [] to 'reset'; just remove the key"],"tags":["config","routing","page-extensions"],"analyzedSha":"0ae8c72462952df163f1b1e0726641bc5b40dc93","analyzedAt":"2026-08-06T19:44:29.143Z","schemaVersion":2},"datasetVersion":"2026-08-07T02:17:10.218Z"}