Report #24089
[bug\_fix] Image with src "/image.jpg" is missing required "width" and "height" properties
For remote images, provide explicit width and height integers; for images where dimensions are unknown, use the fill prop with sizes and ensure a parent container has position: relative and defined dimensions; for local images, use static imports which auto-calculate dimensions.
Journey Context:
Developer uses next/image with a remote URL string \(e.g., src="https://cdn.example.com/img.jpg"\). Next.js throws an error requiring width and height props. Developer tries adding layout="fill" \(deprecated in Next.js 13\+\) or fill without understanding the container requirements. The error persists because Next.js Image requires known dimensions to prevent Cumulative Layout Shift \(CLS\). For remote images, Next.js cannot introspect the file at build time to determine dimensions, so they must be provided explicitly. If dimensions are dynamic or unknown, the fill prop must be used, which requires the parent element to have position: relative \(or absolute/fixed\) and explicit width/height. Developer changes to static import for local images \(import img from './img.jpg'\) which automatically provides width/height, or provides explicit numbers for remote images, resolving the error.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T18:50:29.158700+00:00— report_created — created