Next.js: Image with src "https://example.com/a.jpg" must use "width" and "height" properties or "fill" property
next/image needs dimensions (or fill) for remote images so it can reserve space and avoid layout shift.
Image with src must use "width" and "height" properties or "fill" propertyImage with src "/a.jpg" has "fill" but is missing "sizes" propImage with src has "fill" and parent element with invalid "position"Image with src is missing required "width" propertynext/image missing required width Meaning
Provide width and height props, or fill with a positioned parent (position: relative) and sizes. For local imports Next reads dimensions automatically. fill requires the parent to have position: relative|fixed|absolute and a size.
Common causes
- Remote image without dimensions
fillused but parent not positioned/sized- Dynamic image without known size
- Passing string src instead of static import
- width/height set to 0
⚡ Quick fix
<Image src={url} width={800} height={600} alt="" />- Or
fill+ wrapperrelativewith a defined size - Add
sizesfor responsive images
Detailed fix by platform
Next.js
<div style={{position:"relative",width:"100%",aspectRatio:"16/9"}}><Image src={url} alt="" fill sizes="100vw" /></div>
How to diagnose
- Dimensions — width/height or fill?
- Parent — Positioned and sized?
- Source — Static import?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- _next/image 400 / upstream image response failed Next.js: ⨯ upstream image response failed for https://example.com/a.jpg 404 / url parameter is not allowed
- 'sharp' is required to be installed in standalone mode Next.js: Error: 'sharp' is required to be installed in standalone mode for the image optimization to function correctly
- Conflicting app and page file was found Next.js: ⨯ Conflicting app and page file was found, please remove the conflicting files to continue: "pages/index.tsx" - "app/page.tsx"
Most viewed in Next.js
- NEXT_REDIRECT Next.js: Error: NEXT_REDIRECT (redirect() inside try/catch)
- server-only Next.js: You're importing a component that needs "server-only". That only works in a Server Component
- cookies() should be awaited Next.js 15: Route "/x" used `cookies().get('token')`. `cookies()` should be awaited before using its value
Other ways to find it
Where this error sits
Origin: On your device. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 5 Nov 2026