Model does not support the requested response modalities: image — Gemini API image output error
The exact error
Model does not support the requested response modalities: image
What it means
You called generateContent with image output requested (responseModalities or response_modalities includes IMAGE), and the model rejected that combination. It comes back as 400 INVALID_ARGUMENT. The end of the message lists what was refused, for example image or image,text. Public reports show three different causes.
- A model that cannot output images. In an issue logged by the gentlebot project in February 2026, an app’s image route called
gemini-2.0-flash, a text model, throughgenerate_content. It got this 400 withimage,textat the end. Gemini image output comes from specific image models, such as thegemini-3.1-flash-imageandgemini-3-pro-imageIDs on Google’s deprecations page. A general text model will not do it. - The model or access state at the time. In Google AI Developers Forum thread 72676, from March 2025, a developer got this error with
gemini-2.0-flash-exp-image-generationand believed image output was not yet open to everyone. A forum member with a Google badge said the earlier restriction was related to early access, and later suggested checking whether the poster’s region was on the available-regions list. A community member posted working code that requested both text and image output. The thread never confirmed which change fixed it. Google’s changelog listsgemini-2.0-flash-exp-image-generationandgemini-2.0-flash-preview-image-generationfor shutdown on November 14, 2025, so code still using those IDs needs a new model anyway. - An SDK bug. In go-genai issue #158, calling
GenerateContentStreamwithIMAGEreturned this error. The issue was closed by a commit titled “fix response modality in streaming mode” in March 2025. Old SDK versions can therefore produce this error for a model that does support images.
Some older examples always send both TEXT and IMAGE. Google’s current Veo page, though, generates an image with response_modalities set to IMAGE alone on a Gemini image model. We found no source showing that image-only output causes this error on current image models.
How to confirm it’s this
- The status is 400
INVALID_ARGUMENTand the message namesimage. - Look at the model ID in the failing request. If it is not an image model, that is the cause. Routers that share one client for text and image routes are a common place for the wrong ID to slip in, as in the gentlebot case.
- Remove
IMAGEfrom the requested modalities and send the request again. If it now succeeds, the model or path does not support image output. - If you are streaming, check your SDK version against the fix in go-genai issue #158.
- Check whether the model ID is still listed on Google’s deprecations and models pages.
Fix
- Call an image model for image output. Google’s Veo page generates the starting image like this. The model ID below is the one the deprecations page lists as current. The page’s own example uses the
-previewID, which is listed there with a June 25, 2026 shutdown date.
image = client.models.generate_content(
model="gemini-3.1-flash-image",
contents=prompt,
config={"response_modalities": ['IMAGE']},
)
- Replace experimental or preview IDs with the replacements on the deprecations page.
- Upgrade the SDK if the error appears only in streaming mode or only in one language’s SDK.
- Split text and image routing. Keep separate model settings for text and image calls so a text model is never asked for images.
Retry or not
No. Whether a model can return images does not change between attempts, so the same request fails the same way. The gentlebot log shows the call going through a backoff-and-retry wrapper and still failing, which only added latency. An agent should treat this as a configuration error. It can switch once to a known image-capable model ID, or drop IMAGE and return text only if the task allows it, and should not loop.
When it’s not this
Image generation is not available in your country.is a 400FAILED_PRECONDITIONabout where the call comes from. The model can produce images, just not for your location.is not found for API version v1betais a 404 for a model ID that does not exist or has been shut down.- No image in a successful response. If the request returns 200 but contains no image part, the request was accepted and something else went wrong.
- Safety blocks return a finish reason on an accepted request, not this 400.
Related errors
- Image generation is not available in your country
- Model not found for API version v1beta
- No image in the response
- IMAGE_OTHER finish reason
- Image blocked by safety filters
Error text last verified against the sources below on .