vercel/next.js · error · Error

Image with src "${src}" has both "fill" and "style.width" pr

Error message

Image with src "${src}" has both "fill" and "style.width" properties. Images with "fill" always use width 100% - it cannot be modified.

What it means

Props validation in getImgProps: fill was combined with a style.width other than 100%. Fill images derive width from their parent container; any other inline width would fight the layout and is rejected.

Source

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

    } else {
      if (fill) {
        if (width) {
          throw new Error(
            `Image with src "${src}" has both "width" and "fill" properties. Only one should be used.`
          )
        }
        if (height) {
          throw new Error(
            `Image with src "${src}" has both "height" and "fill" properties. Only one should be used.`
          )
        }
        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}".`
          )
        }

View on GitHub (pinned to 0eb3775416)

Solutions

  1. Remove style.width when using fill; size the parent container instead.
Defensive patterns

Strategy: validation

When it happens

Trigger: next/image with fill also sets style.width.

Common situations: fill images always use width 100%; custom style.width is rejected.


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