Same issue here, payloads that were fine before now suddenly generate 417 errors. These are regular payloads, so donāt know what happened in flagging behaviour.
Prompt doesnāt seem to matter (tried different ones, all give 417)
Origin doesnāt seem to matter (tried from different IPās, all give 417)
API Key doesnāt seem to matter (tried different key belonging to different Google Dev account, always 417), the same API keys do work in AI Studio with the same prompt
Hi I am getting the same error message for the past 4 hours. I am using the Gemini API for generating images with Nano Banana and everything was working fine for the past 3 months. I hope this is some bug/issue with the Google servers and not with my server IPs Every request now is blocked. I hope it will be resolved soon. Do you have any idea what I could do?
It seems to be related to a tightening of the size restriction. Iām only getting it with an image upload (base64) added. When I resize the image and then base64 encode it, the error dissappears.
The speed of the 417 response indicates that it doesnāt actually reach the LLM, so the addition of a simple size filter should be the cause. Testing and confirming now.
I have confirmed it (on different keys/IPās etc.), if you reduce the size of the payload (in my case, the base64 encoded image), it doesnāt return a 417 anymore.
Yes, Iāve also tried that method. And if I use only one image with my prompt and the image size is below 500kb I donāt get the error. Unfortunately this is not a working workaround for me because I need the images to be in higher resolution. I hope this wonāt be a permanent limitation.
Iāve found a workaround working with large size images. You just need to make the requests with direct URLs of the images with the prompt and not to add them as base64 prompt. Like that:
$parts = [
[
āfile_dataā => [
āmime_typeā => āimage/jpegā,
āfile_uriā => āhttps://yourdomain.com/image_1.jpgā,
],
],
[
āfile_dataā => [
āmime_typeā => āimage/pngā,
āfile_uriā => āhttps://yourdomain.com/image_2.pngā,
],
],
[
ātextā => $prompt,
],
];
Iām experiencing the same error as well. Iām not sure whether this is a temporary bug in Google Gemini or something more permanent. It was working normally just a few hours ago, and then suddenly it stopped working. As far as I can see, there havenāt been any updates that would explain the change.
Hey everyone, just wanted to share what worked for us. We were getting the exact same 417 (Expectation Failed) error across all our C#/.NET integrations (Revit and Word add-ins) whenever we sent larger payloads like documents or images.
We isolated the issue by testing with a minimal Python script, which worked perfectly. It turns out the error is heavily tied to the Expect: 100-continue header, which C#ās HttpClient automatically attaches to requests with larger bodies. It seems Googleās proxy/firewall infrastructure recently added a strict size filter that aggressively rejects this specific pre-flight check, instantly returning the 417 error without even reaching the LLM.
The Fix for C#/.NET: You just need to explicitly disable this header in your code before making the request, forcing the client to send the payload directly:
C#
// If using modern HttpClient:
httpClient.DefaultRequestHeaders.ExpectContinue = false;
// If using older .NET Framework (like VSTO or Revit Add-ins):
System.Net.ServicePointManager.Expect100Continue = false;
Once we disabled that header, our large text requests and file uploads started working perfectly again. Hope this helps anyone stuck on the same stack!