Gemini 2.5 Pro with empty response.text

I’m using the LiteLLM Latest, and I also have the same issue. Has it been solved yet?

1 Like

I am facing the same issue. Any progress on getting this fixed?

1 Like

Same Problem :confused: I think it might be occurring due to robots.txt file. In the meantime I’m going to use a workaround to just not use the search grounding after it fails w/search grounding the first time.

1 Like

It’s still not working. I’m pretty sure it has something to do with anti ai prompting in websites which will take a minute to fix.

1 Like

Hi, our team is actively addressing this issue. Sharing a sample prompt or reproducible code would significantly accelerate the debugging process.

Thank you.

1 Like

IF Gemini 2.5 outputs at all, it is absolutely awesome. But this “bug” is truly a showstopper to use it in production. Hope this gets resolved soon!

1 Like

@Rodger_Blom We are getting around the problem with putting the get response from client in a retry loop. We set our return count to 3 and so far it eventually will return a response. We found this important in general because not only is this empty response an issue, but also to support several valid reasons (in the failure_reason field) which include if the reponse being synthesized resulted in it included copy-righted material. Obviously all of these are in the response LOL, but still the idea works really well for us.

2 Likes

Thanks for sharing, very much appreciated! I am using Gemini in an N8N Ai agent and I just finished implementing exactly the same logic in N8N. I was not sure if it would work at all because I haven’t had time to test it yet. Your message gives me hope! I’ll let you know the outcome. Still hope Google fixes this soon. Also curious if this burns money because of high input token count…

I can confirm the strategy of @Bryan_Hughes works. I had some edge cases where it took more that 3 retries so I increased it even further. I hope this issue gets resolved soon!

The issue with the retry loop, which it does often take 2 to 3 tries is that my guess is behind the scene, the model worked and it is the response system that is broken? So probably still getting charged for all those failed responses.

Hi @GUNAND_MAYANGLAMBAM I was thinking about this issue. We are using a pretty massive system prompt and input prompt with extensive tool calls. Anthropic “released” a think tool implementation so the AI agent can do even better thinking when using extensive tool calls: "Modified by moderator"This approach is implemented in N8N as an “think tool” for the AI Agents in N8N. I noticed during testing quite some workflows stall on calling tools, specifically calling the think tool. Although this can be pure coincidentally. In the Ai Agent Gemini 2.5 logs I quite often noticed a stop sequence was initiated. Maybe this is an important clue to be able to reproduce this issue? Create an AI agent in N8N that does extensive tool calling will very likely trigger this issue. Hope this helps finding the root cause.

1 Like

Hi, any news from dev team? we have switched to Gemini Pro 2.5 but I think if it doesn’t get resolved we will have to redo the switch, unfortunately it is unreliable even the call retry sometimes works sometimes doesn’t. It doesn’t make sense. Gemini is great but unfortunately unreliable :frowning:

Any news on this @GUNAND_MAYANGLAMBAM?

Just adding
I am seeing the same issue. We manually call the API Content generation endpoint. We then format the response using the SDK (the same way SDK does)

              dict_response = await response.json()
              response_dict = _GenerateContentResponse_from_mldev(ApiClient(api_key=self.api_key), dict_response)

              return_value = GenerateContentResponse._from_response(response=response_dict, kwargs=payload)
              ApiClient(api_key=self.api_key)._verify_response(return_value)

We call the method from the sdk to generate response using SDK

But basically gemini has this issue where it is just returning empty content. It is very sporadic and super annoying. This issue has been around for months.

Seeing the exact same issue. In our experience, the issue happens predominantly with Search grounded calls. We have been working with a retry workaround for a couple months, but even this fails on occassion (after 3 retries). Frequency seems to be getting worse, now affects 1 out of 3 calls with search grounding.

Wondering why this topic is marked as solved without a solution.

I also would like to reraise this issue.
We are experiencing empty responses from the gemini-2.5-flash model with streaming enabled. No errors logged, therefore our original retry logic failed and we now using the same approach as Bryan outlined.
We had multiple User reaching out on 5 different days. Langfuse and our serverlogs confirm that the gemini api returns empty strings.
Therefore this issue should not be marked as solved. It would be great if someone could look into this again.

Hi Richard and everyone, that was my mistake. I seemed to have marked it solved by accident. I unmarked it.

2 Likes

Thanks @Bryan_Hughes . Even though Gemini 2.5 pro is now GA, this problem still persists every single day.

I think it must be a bug in the API. I use the AI package from Vercel in JS and this also happens sometimes as well. But I can actually see the output and it just “-------------------------------” until it is out of tokens… The AI model is also buggy…

It usually happens when it makes a markdown Table.

I have also experienced that it hangs for 1 or 2 min and then it outputs an empty string as well now. I have also experienced that sometimes it outputs something completely different, such as a python script instead of cleaning up broken markdown…

I think I will lay low on this new model until these silly mistakes are fixed