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

Config validation in assignDefaultsAndValidate: the pageExtensions key was checked with Array.isArray and failed — it is not an array. Page extensions must be a list of file-extension strings (e.g. ['tsx','ts','js']); the received value is echoed in the error so the next.config.js entry can be fixed or removed.

Solutions

  1. Set pageExtensions to an array of strings, e.g. ['tsx','ts','jsx','js'].
Defensive patterns

Strategy: validation

When it happens

Trigger: pageExtensions is not an array of strings.

Common situations: Passing a string or other type as pageExtensions in next.config.


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

Appendix: source

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

        // 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 34433fd12e)