vercel/next.js · error · Error
Specified pageExtensions is an empty array. Please update it
Error message
Specified pageExtensions is an empty array. Please update it with the relevant extensions or remove it.
What it means
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.
Source
Thrown at packages/next/src/server/config.ts:375
}
// make sure distDir isn't an empty string as it can result in the provided
// directory being deleted in development mode
if (userDistDir.length === 0) {
throw new Error(
`Invalid distDir provided, distDir can not be an empty string. Please remove this config or set it to undefined`
)
}
}
if (key === 'pageExtensions') {
if (!Array.isArray(value)) {
throw new Error(
`Specified pageExtensions is not an array of strings, found "${value}". Please update this config or remove it.`
)
}
if (!value.length) {
throw new Error(
`Specified pageExtensions is an empty array. Please update it with the relevant extensions or remove it.`
)
}
value.forEach((ext) => {
if (typeof ext !== 'string') {
throw new Error(
`Specified pageExtensions is not an array of strings, found "${ext}" of type "${typeof ext}". Please update this config or remove it.`
)
}
})
}
const defaultValue = (defaultConfig as Record<string, unknown>)[key]
if (
!!value &&
value.constructor === Object &&View on GitHub (pinned to 0ae8c72462)
Solutions
- Populate the array with the extensions you use, e.g. `pageExtensions: ['tsx', 'ts', 'jsx', 'js']`
- Remove the pageExtensions key to use the default
Example fix
// before
module.exports = { pageExtensions: [] }
// after
module.exports = { pageExtensions: ['tsx', 'ts'] } Defensive patterns
Strategy: validation
Validate before calling
if (Array.isArray(pageExtensions) && pageExtensions.length === 0) {
pageExtensions = ['tsx', 'ts', 'jsx', 'js']
} Type guard
const isNonEmptyStringArray = (v: unknown): v is string[] => Array.isArray(v) && v.every((e) => typeof e === 'string') && v.length > 0
Prevention
- Guard dynamically-built extension arrays with a fallback default
- Don't set pageExtensions to [] to 'reset'; just remove the key
When it happens
Trigger: Setting `pageExtensions: []` in next.config.
Common situations: 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.
Related errors
- Specified pageExtensions is not an array of strings, found "
- Specified pageExtensions is not an array of strings, found "
- Failed to resolve pattern "${patterns.join(',')}": ${error.m
- Specified basePath is not a string, found type "${typeof res
- Specified basePath /. basePath has to be either an empty str
AI-assisted analysis of vercel/next.js@0ae8c72462 (2026-08-06).
Data as JSON: /api/errors/6198968fbdfa38f5.
Report an issue: GitHub.