# Error: Invalid src prop on `next/image`, hostname "example.com" is not configured under images.remotePatterns

- **ID:** `nextjs/next-image-unconfigured-hostname`
- **Domain:** nextjs
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 95%

## Root Cause

Next.js Image component requires external image hostnames to be explicitly allowed in next.config.js under images.remotePatterns for security and optimization; otherwise, it throws this error.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Next.js 13.0.0 | active | — | — |
| Next.js 14.0.0 | active | — | — |
| Next.js 14.2.0 | active | — | — |

## Workarounds

1. **Add the hostname to next.config.js: 'images: { remotePatterns: [{ protocol: "https", hostname: "example.com" }] }'** (95% success)
   ```
   Add the hostname to next.config.js: 'images: { remotePatterns: [{ protocol: "https", hostname: "example.com" }] }'
   ```
2. **If using Next.js 14+, use the 'images.unoptimized: true' config to disable all image optimization (not recommended for production).** (90% success)
   ```
   If using Next.js 14+, use the 'images.unoptimized: true' config to disable all image optimization (not recommended for production).
   ```
3. **For multiple hostnames, add each one: 'images: { remotePatterns: [{ protocol: "https", hostname: "example.com" }, { protocol: "https", hostname: "cdn.example.com" }] }'** (95% success)
   ```
   For multiple hostnames, add each one: 'images: { remotePatterns: [{ protocol: "https", hostname: "example.com" }, { protocol: "https", hostname: "cdn.example.com" }] }'
   ```

## Dead Ends

- **** — images.domains is deprecated since Next.js 13; images.remotePatterns is the required configuration. (70% fail)
- **** — remotePatterns requires explicit protocol and hostname; wildcards must be in the hostname field, not as a string pattern. (60% fail)
- **** — This bypasses optimization but still requires the hostname to be configured for security; the error persists. (80% fail)
