vercel/next.js · error · Error

Specified images.remotePatterns should be an Array received

Error message

Specified images.remotePatterns should be an Array received ${typeof images.remotePatterns}.\nSee more info here: https://nextjs.org/docs/messages/invalid-images-config

What it means

Error "Specified images.remotePatterns should be an Array received ${typeof images.remotePatterns}.\nSee more info here: https://nextjs.org/docs/messages/invalid-images-config" thrown in vercel/next.js.

Solutions

  1. Set images.remotePatterns to an array of pattern objects or strings.
Defensive patterns

Strategy: validation

When it happens

Trigger: images.remotePatterns is not an array.

Common situations: Setting remotePatterns to a non-array value in next.config images.


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

Appendix: source

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

        // static import images are automatically allowed
        images.localPatterns.push({
          pathname: '/_next/static/immutable/media/**',
          search: '',
        })
      }
    } else {
      // All paths are not allowed for a search query by default.
      images.localPatterns = [
        {
          pathname: '**',
          search: '',
        },
      ]
    }

    if (images.remotePatterns) {
      if (!Array.isArray(images.remotePatterns)) {
        throw new Error(
          `Specified images.remotePatterns should be an Array received ${typeof images.remotePatterns}.\nSee more info here: https://nextjs.org/docs/messages/invalid-images-config`
        )
      }

      // We must convert URL to RemotePattern since URL has a colon in the protocol
      // and also has additional properties we want to filter out. Also, new URL()
      // accepts any protocol so we need manual validation here.
      images.remotePatterns = images.remotePatterns.map(
        ({ protocol, hostname, port, pathname, search }) => {
          const proto = protocol?.replace(/:$/, '')
          if (!['http', 'https', undefined].includes(proto)) {
            throw new Error(
              `Specified images.remotePatterns must have protocol "http" or "https" received "${proto}".`
            )
          }
          return {
            protocol: proto as 'http' | 'https' | undefined,
            hostname,

View on GitHub (pinned to 34433fd12e)