Report #104461
[bug\_fix] Next.js Image Optimization: \`Error: Invalid src prop\` or \`Image is missing required 'src' property\` or \`Unhandled Runtime Error: Image is missing required 'src' property\`
Ensure the \`src\` prop is a string and not undefined. For external images, configure \`next.config.js\` with \`images.remotePatterns\` or \`images.domains\` \(deprecated\) to allow the domain. Also, the \`width\` and \`height\` props are required unless using \`fill\` or \`layout='fill'\` \(legacy\).
Journey Context:
A developer uses the Next.js \`\` component with a dynamic \`src\` from an API. Initially, \`src\` is undefined during loading, causing an error. Or they use an external image URL without adding the domain to the config. The error can be cryptic: 'Invalid src prop' or 'Image is missing required src'. The developer may check the URL but it's correct. The root cause is either the \`src\` being undefined at render time \(e.g., from a state that hasn't loaded yet\) or the domain not being allowed. The fix involves guarding the \`src\` with a conditional render until it's defined, and updating \`next.config.js\` to allow the external domain. The proven fix is documented in Next.js image configuration.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-08-23T20:04:27.317977+00:00— report_created — created