vercel/next.js · error · Error

Image with src "${src}" is missing required "height" propert

Error message

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

What it means

Props validation in getImgProps: without fill, the height prop is missing or undefined. Both width and height are required for statically sized images so the browser can reserve the correct aspect ratio before load.

Source

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

          )
        }
        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)) {
          throw new Error(
            `Image with src "${src}" cannot start with a space or control character. Use src.trimStart() to remove it or encodeURIComponent(src) to keep it.`
          )
        }
        // eslint-disable-next-line no-control-regex
        if (/[\x00-\x20]$/.test(src)) {
          throw new Error(
            `Image with src "${src}" cannot end with a space or control character. Use src.trimEnd() to remove it or encodeURIComponent(src) to keep it.`
          )

View on GitHub (pinned to 0eb3775416)

Solutions

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

Strategy: validation

When it happens

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

Common situations: An Image with a string src and width but no height and no fill.


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