# Next.js: ⨯ upstream image response failed for https://example.com/a.jpg 404 / url parameter is not allowed

**Code:** `_next/image 400 / upstream image response failed` · **Category:** Next.js · **Seen on:** Next.js

The Image Optimization API couldn't fetch or accept the source image (404, blocked host, wrong type).

## Meaning

`/_next/image` fetches the remote image on the server. If it returns 404/403, isn't an image, or the host isn't in `images.remotePatterns`, you get 400/404 and a broken image. Verify the URL opens, configure `remotePatterns`, and for local images use static imports or `/public` paths.

## Common causes

- Remote URL returns 404/403/redirect
- Host not in `remotePatterns` ("url parameter is not allowed")
- Server can't reach the image host (firewall/DNS)
- Unsupported format or too large
- Hot-linking protection

## Quick fix

1. Open the image URL in a browser/curl
2. Add to `images.remotePatterns: [{ protocol: "https", hostname: "example.com" }]`
3. Use `unoptimized` for problematic sources

## Detailed fix by platform

### Next.js

1. `images: { remotePatterns: [{ protocol: "https", hostname: "cdn.example.com", pathname: "/**" }] }`

## How to diagnose

1. **Status** — Upstream response?
2. **Config** — remotePatterns?
3. **Network** — Server reachable?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/nextjs/image-optimizer-400-upstream-invalid)
