vercel/next.js · error · Error

Specified pageExtensions is not an array of strings, found "

Error message

Specified pageExtensions is not an array of strings, found "${value}". Please update this config or remove it.

What it means

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.

Source

Thrown at packages/next/src/server/config.ts:369

        // don't allow public as the distDir as this is a reserved folder for
        // public files
        if (userDistDir === 'public') {
          throw new Error(
            `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`
          )
        }
        // 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.`
            )
          }
        })
      }

View on GitHub (pinned to 0ae8c72462)

Solutions

  1. Provide an array of strings: `pageExtensions: ['tsx', 'ts']`
  2. Remove the pageExtensions key to restore the default `['tsx', 'ts', 'jsx', 'js']`

Example fix

// before
module.exports = { pageExtensions: 'tsx' }
// after
module.exports = { pageExtensions: ['tsx'] }
Defensive patterns

Strategy: type-guard

Validate before calling

if (!Array.isArray(pageExtensions)) {
  throw new TypeError('pageExtensions must be an array')
}

Type guard

const isStringArray = (v: unknown): v is string[] =>
  Array.isArray(v) && v.length > 0 && v.every((e) => typeof e === 'string')

Prevention

When it happens

Trigger: Setting `pageExtensions: 'tsx'` (string instead of array), `pageExtensions: null`, or `pageExtensions: { tsx: true }` in next.config.

Common situations: Assuming pageExtensions takes a single string. Copying an example that forgot the brackets. Mixing up with other config keys that accept a single string.

Related errors


AI-assisted analysis of vercel/next.js@0ae8c72462 (2026-08-06). Data as JSON: /api/errors/b0516cebbe1b0d64. Report an issue: GitHub.