vercel/next.js · error · Error

Image with src "${src}" is missing required "width" property

Error message

Image with src "${src}" is missing required "width" property.

What it means

Props validation in getImgProps: the image is not using fill, but no width prop (or a non-numeric one) was supplied. Non-fill images need intrinsic dimensions so the layout can reserve space and prevent CLS; the sibling height checks follow the same pattern.

Source

Thrown at packages/next/src/shared/lib/get-img-props.ts:509

        }
        if (style?.position && style.position !== 'absolute') {
          throw new Error(
            `Image with src "${src}" has both "fill" and "style.position" properties. Images with "fill" always use position absolute - it cannot be modified.`
          )
        }
        if (style?.width && style.width !== '100%') {
          throw new Error(
            `Image with src "${src}" has both "fill" and "style.width" properties. Images with "fill" always use width 100% - it cannot be modified.`
          )
        }
        if (style?.height && style.height !== '100%') {
          throw new Error(
            `Image with src "${src}" has both "fill" and "style.height" properties. Images with "fill" always use height 100% - it cannot be modified.`
          )
        }
      } else {
        if (typeof widthInt === 'undefined') {
          throw new Error(
            `Image with src "${src}" is missing required "width" property.`
          )
        } else if (isNaN(widthInt)) {
          throw new Error(
            `Image with src "${src}" has invalid "width" property. Expected a numeric value in pixels but received "${width}".`
          )
        }
        if (typeof heightInt === 'undefined') {
          throw new Error(
            `Image with src "${src}" is missing required "height" property.`
          )
        } else if (isNaN(heightInt)) {
          throw new Error(
            `Image with src "${src}" has invalid "height" property. Expected a numeric value in pixels but received "${height}".`
          )
        }
        // eslint-disable-next-line no-control-regex
        if (/^[\x00-\x20]/.test(src)) {

View on GitHub (pinned to 0eb3775416)

Solutions

  1. Add a numeric width prop (and height) to the Image, or use fill.
Defensive patterns

Strategy: validation

When it happens

Trigger: next/image without fill is missing the width prop.

Common situations: An Image with a string src and no width/height or fill provided.


AI-assisted analysis of vercel/next.js@0eb3775416 (2026-08-19). Data as JSON: /api/errors/9234e5c68f64c558. Report an issue: GitHub.