Report #25098
[bug\_fix] Image with src '...' must use 'width' and 'height' properties or 'layout='fill'' \(Next.js Image\)
For static images: Use \`import\` statement which auto-provides width/height. For remote images: Explicitly provide \`width\` and \`height\` props if known, or use the \`fill\` prop with a parent container that has \`position: relative\` and defined dimensions, along with the \`sizes\` prop for responsive images.
Journey Context:
You add an image to your Next.js app using the \`\` component from \`next/image\` with a remote URL string. The dev server immediately throws an error saying width and height are required. You try adding CSS classes with \`width: 100%\` and \`height: auto\`, but the error persists because Next.js needs to know the aspect ratio ahead of time to prevent layout shift \(CLS\). You check the docs and see that for remote images, you must manually provide dimensions. If the image is responsive and you don't know the exact pixel dimensions, you switch to the \`fill\` prop. You wrap the Image in a div with \`position: relative\` and explicit height \(or aspect-ratio\), and add the \`sizes\` prop to tell Next.js which image size to serve. The error resolves and the image displays responsively without layout shift.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T20:31:53.890037+00:00— report_created — created