Bolt ui

Next.js Image Component Optimization Error

Using next/image causes errors. Image won't load or throws configuration error. Image optimization fails.

Error about missing width/height, or optimization service unavailable.

Error Messages You Might See

Error: Image with src should have width and height Error: Image Optimization API error Image domain not configured Unoptimized image with static size

Common Causes

  1. Width/height not provided on Image component (required for static imports)
  2. External image domain not whitelisted in next.config.js
  3. Image format not supported by Next.js optimization
  4. Invalid src prop (relative path instead of absolute)
  5. Image optimization disabled but image props incorrect

How to Fix It

Always provide width and height: ...

For external images, add to next.config.js: { images: { remotePatterns: [{ hostname: 'example.com' }] } }

Use static import when possible: import img from '@/public/img.jpg'; ...

Ensure image file exists and is valid format (jpg, png, webp, gif)

Real developers can help you.

Daniel Vázquez Daniel Vázquez Software Engineer with over 10 years of experience on Startups, Government, big tech industry & consulting. Mehdi Ben Haddou Mehdi Ben Haddou - Founder of Chessigma (1M+ users) & many small projects - ex Founding Engineer @Uplane (YC F25) - ex Software Engineer @Amazon and @Booking.com Taufan Taufan I’m a product-focused engineer and tech leader who builds scalable systems and turns ideas into production-ready platforms. Over the past years, I’ve worked across startups and fast-moving teams, leading backend architecture, improving system reliability, and shipping products used by thousands of users. My strength is not just writing code — but connecting product vision, technical execution, and business impact. prajwalfullstack prajwalfullstack Hi Im a full stack developer, a vibe coded MVP to Market ready product, I'm here to help Krishna Sai Kuncha Krishna Sai Kuncha Experienced Professional Full stack Developer with 8+ years of experience across react, python, js, ts, golang and react-native. Developed inhouse websearch tooling for AI before websearch was solved : ) rayush33 rayush33 JavaScript (React.js, React Native, Node.js) Developer with demonstrated industry experience of 4+ years, actively looking for opportunities to hone my skills as well as help small-scale business owners with solutions to technical problems Stanislav Prigodich Stanislav Prigodich 15+ years building iOS and web apps at startups and enterprise companies. I want to use that experience to help builders ship real products - when something breaks, I'm here to fix it. Victor Denisov Victor Denisov Developer Matt Butler Matt Butler Software Engineer @ AWS PawelPloszaj PawelPloszaj I'm fronted developer with 10+ years of experience with big projects. I have small backend background too

You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.

Get Help

Frequently Asked Questions

When can I skip width/height?

Only with layout=fill (position: absolute parent) or static import with Babel plugin

How do I whitelist external image domains?

In next.config.js: images: { remotePatterns: [{ hostname: 'cdn.example.com', protocol: 'https' }] }

Is Image component always better than img tag?

Yes for web. Image automatically optimizes, lazy loads, handles responsive sizes. Always use next/image

Related Bolt Issues

Can't fix it yourself?
Real developers can help.

You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.

Get Help