Report #17207
[bug\_fix] Image with src "..." is missing required "width" and "height" properties \(Next.js Image component\)
Provide explicit \`width\` and \`height\` attributes for images where dimensions are known at build time to prevent layout shift. For responsive images with unknown dimensions or fill-parent layouts, use the \`fill\` prop and style the parent container with \`position: relative\`, combined with the \`sizes\` prop for proper optimization.
Journey Context:
Developer migrates from standard \`\` tags to Next.js \`\` for optimization. They replace \`\` with \`\`. Immediately, the build fails or the dev server shows a red error overlay demanding width and height. Developer checks the docs and sees Next.js requires dimensions to calculate aspect ratio and prevent CLS. They try adding arbitrary width/height but the image distorts. They realize for their hero banner that fills the viewport, they should use the \`fill\` prop. They add \`fill\` and \`style=\{\{objectFit: 'cover'\}\}\`. Error changes to say parent must have \`position: relative\`. They wrap the Image in a div with \`className="relative w-full h-96"\`. Error resolves and image displays responsively.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T04:46:43.362294+00:00— report_created — created