Since this morning (April 14, 2026), `gemini-3.1-flash-image-preview` consistently returns `500 INTERNAL` when sending images as input in a multi-turn chat session. Single-turn image generation on the same chat works fine. This was working perfectly for 2+ months prior — nothing changed on our end.
**Error:**
500 INTERNAL. {‘error’: {‘code’: 500, ‘message’: ‘Internal error encountered.’, ‘status’: ‘INTERNAL’}}
**What works:**
- Creating a chat session and generating an image from a text prompt (message 1) → succeeds every time
**What breaks:**
- Sending a second message on the same chat that includes the generated image as input → 500 INTERNAL every time
**Our use case:**
We use multi-turn chat to generate sequential comic panels with visual continuity. Panel 1 is generated from text only. Panels 2+ send the previous panel image back into the chat for style/scene continuity. This has been working reliably since February.
**Minimal reproduction script:**
python
import sys
import io
from PIL import Image
from google import genai
from google.genai import types
api_key = sys.argv[1]
client = genai.Client(api_key=api_key)
chat = client.chats.create(
model="gemini-3.1-flash-image-preview",
config=types.GenerateContentConfig(response_modalities=["Image"]),
)
# Message 1 — works
response = chat.send_message("A cozy bar at night with two friends laughing.")
img = None
for part in response.candidates[0].content.parts:
if part.inline_data:
img = Image.open(io.BytesIO(part.inline_data.data))
print(f"Message 1: SUCCESS ({img.size[0]}x{img.size[1]})")
# Message 2 — crashes with 500 INTERNAL
try:
response = chat.send_message([
"Previous panel for continuity:",
img,
"Same bar. The friends clink their glasses together.",
])
print("Message 2: SUCCESS")
except Exception as e:
print(f"Message 2: FAILED — {e}")
Test results:
| Message | Image input? | Result |
|---|---|---|
| 1 | No | SUCCESS |
| 2 | Yes (prev image) | 500 INTERNAL |
| 3 | No (reset after fail) | 500 INTERNAL (chat corrupted) |
| 4 | No | SUCCESS (recovered) |
Environment:
-
Model:
gemini-3.1-flash-image-preview -
SDK:
google-genai(Python) -
Region: EU (Hetzner, Germany)
-
Worked fine until: April 13, 2026
-
Broken since: April 14, 2026 morning (CET)
This appears to be a server-side regression in the multi-turn chat image handling. Single-turn generation, including with the exact same API key and prompts, works without issues.