vercel/next.js · error · Error

Specified images.localPatterns should be an Array received

Error message

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

What it means

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

Solutions

  1. Set images.localPatterns to an array of pattern objects.
Defensive patterns

Strategy: validation

When it happens

Trigger: images.localPatterns is not an array.

Common situations: Setting localPatterns to a string or object instead of an array in next.config images.


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

Appendix: source

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

      if (result.assetPrefix === '') {
        result.assetPrefix = result.basePath
      }
    }
  }

  if (result?.images) {
    const images: ImageConfig = result.images

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

    if (images.localPatterns) {
      if (!Array.isArray(images.localPatterns)) {
        throw new Error(
          `Specified images.localPatterns should be an Array received ${typeof images.localPatterns}.\nSee more info here: https://nextjs.org/docs/messages/invalid-images-config`
        )
      }
      // avoid double-pushing the same pattern if it already exists
      if (
        !images.localPatterns.some(
          (pattern) =>
            pattern.pathname === '/_next/static/media/**' &&
            pattern.search === ''
        )
      ) {
        // static import images are automatically allowed
        images.localPatterns.push({
          pathname: '/_next/static/media/**',
          search: '',
        })
      }
      if (

View on GitHub (pinned to 34433fd12e)