Report #36647
[bug\_fix] Image element is missing required "width" and "height" properties \(Next.js Image component\)
Provide explicit number values for width and height props to prevent layout shift \(CLS\), or use the fill property with style/object-fit and ensure the parent container has position: relative and defined dimensions. For remote images, configure next.config.js remotePatterns and use the sizes prop with fill for responsive images.
Journey Context:
Developer migrates from HTML img to Next.js Image for optimization. Replaces with . Immediately gets error about missing width and height. Developer tries width="100%" which fails \(expects number\). Tries adding fill=\{true\} but image collapses to 0px height because parent has no relative positioning. Developer reads about Cumulative Layout Shift \(CLS\) and realizes Next.js requires explicit dimensions to reserve space during SSR. Eventually learns to use width/height for known images, or fill with sizes for responsive layouts, ensuring parent has position: relative and overflow: hidden or defined height.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T15:59:25.947045+00:00— report_created — created