Report #65392
[bug\_fix] Image with src "..." is missing required "width" and "height" properties or fill prop
For local images imported with import statement, Next.js calculates size automatically. For remote images \(URLs\), provide width and height numbers, or use the fill prop with sizes and ensure parent has position: relative
Journey Context:
Developer replaces standard with next/image for optimization. They use a remote URL from a CMS. The dev server immediately throws an error demanding width and height. Developer tries adding width="100%" which fails because Next.js requires numeric pixels for layout stability. They try adding fill without understanding the CSS requirements, causing the image to collapse to 0px height or fill the entire viewport. After reading the error message carefully, they realize fill requires the parent to have defined dimensions and position: relative. The fix works because Next.js uses the numeric dimensions to prevent Cumulative Layout Shift \(CLS\) by reserving space before the image loads.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T16:14:20.264547+00:00— report_created — created