vercel/next.js · error · Error

Specified images should be an object received

Error message

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

What it means

Images config validation in assignDefaultsAndValidate: result.images is present but typeof images is not 'object' (e.g. a string or boolean). The whole images block must be an options object; the received type is named and the error links the invalid-images-config docs.

Solutions

  1. Set images to an object in next.config.js.
Defensive patterns

Strategy: validation

When it happens

Trigger: images config is not an object.

Common situations: Passing an array or primitive as the images option in next.config.


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

Appendix: source

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

    if (result.basePath !== '/') {
      if (result.basePath.endsWith('/')) {
        throw new Error(
          `Specified basePath should not end with /, found "${result.basePath}"`
        )
      }

      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 === ''
        )
      ) {

View on GitHub (pinned to 34433fd12e)