Next.js Error: Invalid `src` prop on `next/image`, hostname is not configured

External image host is not allowlisted in `next.config.mjs` `images.remotePatterns`.

Runs locally in browser Free · No login Independently Verified 2026-11-25 v4.1.0
Identifier: Next.js Error Platform: JavaScript
Common Root Causes:
  • External image host is not allowlisted in `next.config.mjs` `images.remotePatterns`.

Interactive Diagnostic Checklist

Verified Solutions:
  1. Add the trusted domain under `images: { remotePatterns: [{ protocol: "https", hostname: "..." }] }`.
Safe Diagnostic Command:
cat next.config.mjs
Warning: Verify configuration changes in staging or with dry-run flags (e.g. nginx -t) before reloading production services.

Technical Explanation

External image host is not allowlisted in `next.config.mjs` `images.remotePatterns`. Recommended diagnostic: `cat next.config.mjs`. Remediation: Add the trusted domain under `images: { remotePatterns: [{ protocol: "https", hostname: "..." }] }`.

Worked Examples

  • Run `cat next.config.mjs` to verify root cause before applying the remediation.

Limitations & Assumptions

  • Always verify configuration changes in staging or with dry-run flags (e.g. `nginx -t`) before reloading production services.

Source References & Verification

Resource ID: err-nextjs-image-hostname-not-configured · Independently verified: 2026-11-25

Related Resources