Next.js 15: next/image hostname not configured
Error: Invalid src prop on `next/image`, hostname "example.com" is not configured under images in your `next.config.js`.
See more info here: https://nextjs.org/docs/messages/next-image-unconfigured-host
Immediate Remediation
bash
images: {
remotePatterns: [
{ protocol: 'https', hostname: 'example.com' },
],
},Root Cause Analysis
The `next/image` component is configured to load images from an external hostname that is not allowed by the `images.remotePatterns` configuration in `next.config.js`. Next.js blocks external hosts by default for security and performance, so you must explicitly allow the hostname.
Verification & Guardrails
- The hostname must match exactly, including subdomains. Use `remotePatterns` with wildcards if needed.
- Ensure the protocol matches (http vs https).
- After changing next.config.js, restart the dev server.
Have a custom or uncategorized crash?
Run your trace through our in-memory client privacy sandbox for instant SRE remediation.