aider icon indicating copy to clipboard operation
aider copied to clipboard

Gemini 2.5 Pro through aistudio: Empty response received from LLM. Check your provider account?

Open zerocorebeta opened this issue 1 year ago • 32 comments

Issue

Funny thing is sending same request again eventually results in success. So why retry mechanism isn't working on EMPTY response?

Version and model info

No response

zerocorebeta avatar Aug 12 '25 05:08 zerocorebeta

Same thing happening to me with aider 0.86.0 and gemini/gemini-2.5-pro.

char-viscid avatar Aug 12 '25 17:08 char-viscid

It was working for some time but then again started getting error:

--- Sending request to asr_pipeline model ---
Aider v0.86.0
Main model: gemini/gemini-2.5-pro-preview-06-05 with diff-fenced edit format
Weak model: gemini/gemini-2.5-flash-preview-04-17
Git repo: .git with 44 files
Repo-map: using 4096 tokens, auto refresh

The token is correct, verified with curl. Google AI studio is also working fine. Have no idea what to check lol

JohnnyRace avatar Aug 13 '25 06:08 JohnnyRace

I've been having the same issue. Even worse, when using gemini 2.5 pro now, aider won't make any changes at all. I have had to go back to deepseek for the time being.

mjredmond avatar Aug 13 '25 15:08 mjredmond

same, automatic retries on empty response might solve this. Gemini would return errors if it's an API key error.

D3MZ avatar Aug 13 '25 16:08 D3MZ

same, automatic retries on empty response might solve this. Gemini would return errors if it's an API key error.

problem is it affects rate limit! also im afraid it cost you if it is aider issue not gemini issue (it count it as a model run not an error in gemini server). so i think it must be inspect better that where is this error comming from

sfalihi avatar Aug 14 '25 07:08 sfalihi

Retrying may cost u money, see this:

░ ░█ Waiting for gemini/gemini-2.5-pro Empty response received from LLM. Check your provider account?

Tokens: 18k sent, 0 received. Cost: $0.02 message, $0.57 session.

zerocorebeta avatar Aug 14 '25 13:08 zerocorebeta

I think this is not real numbers, it's just expected cost in case the request reaches the LLM, but it seems that it's not. I'm also not sure about rate limit since I tried both aider and request using curl and stand-alone request work, console also work. The issue was only in Aider and I'm wondering why. Retrying is implemented well for Anthropic BTW and seems that it doesn't cost money.

JohnnyRace avatar Aug 14 '25 13:08 JohnnyRace

I looked below the hood, the EMPTY response is coming from the API. Testing via curl does not count unless u are sending API same 5-10K input tokens through curl. Web UI is whole different thing.

zerocorebeta avatar Aug 14 '25 14:08 zerocorebeta

gemini-2.5-pro is working through openrouter. Doesn't openrouter just pass through the api calls to google? Seems strange.

mjredmond avatar Aug 14 '25 15:08 mjredmond

I encountered the same issue. Retrying the same prompt with resetting chat didn't help initially. So, I responded to the error with "Do you hear me?". The model answered "yes" and did what I asked in my previous prompt.

But later I checked out the exact same commit on which I asked the problematic prompt and asked it again. This time, I did not had any errors. Since @zerocorebeta says that the API actually returns empty response, I think it may be Google's problem.

hahaslav avatar Aug 14 '25 17:08 hahaslav

I encountered the same issue. Retrying the same prompt with resetting chat didn't help initially. So, I responded to the error with "Do you hear me?". The model answered "yes" and did what I asked in my previous prompt.

But later I checked out the exact same commit on which I asked the problematic prompt and asked it again. This time, I did not had any errors. Since @zerocorebeta says that the API actually returns empty response, I think it may be Google's problem.

I'm not so sure the gemini api is receiving the request. I'm getting this error as well, and I'm monitoring all the traffic sent from aider to gemini and I don't see the request sent from aider to gemini. I believe it's an aider issue? I'm curious if a rollback to prior to 0.86.0 will fix it? I'll try that next. If not, and I have some time, I'll give an attempt at a PR.

I'm also happy to see I'm not the only one seeing this. So hopefully we can draw some attention to this and get it fixed.

szmania avatar Aug 14 '25 17:08 szmania

I can confirm that downgrading to v0.85.0 seems to have fixed it. No errors with gemini-2.5-pro for 7 attempts.

It just seems like aider is waiting longer for a gemini response, instead of failing quickly. Which is why its working?

But I'm scratching my head trying to find out what the cause is in the diff: https://github.com/Aider-AI/aider/compare/v0.85.0...v0.86.0

szmania avatar Aug 14 '25 20:08 szmania

I can confirm that downgrading to v0.85.0 seems to have fixed it. No errors with gemini-2.5-pro for 7 attempts.

It just seems like aider is waiting longer for a gemini response, instead of failing quickly. Which is why its working?

But I'm scratching my head trying to find out what the cause is in the diff: v0.85.0...v0.86.0

It is a good idea to try downgrading. I tried aider v0.85.0, but I've got the empty response on my 4th prompt and all the next ones.

As for your observation of aider not sending requests to gemini, I'm not sure about that. I spammed the same request that caused empty response 9 times and the dashboard in Google AI Studio reported at least 6 new requests to the model with at least 25k input tokens. Aider can have issues with sending requests, but Google receives at least some requests.

UPD: v0.84.0 also has this issue.

hahaslav avatar Aug 14 '25 21:08 hahaslav

I can confirm that downgrading to v0.85.0 seems to have fixed it. No errors with gemini-2.5-pro for 7 attempts. It just seems like aider is waiting longer for a gemini response, instead of failing quickly. Which is why its working? But I'm scratching my head trying to find out what the cause is in the diff: v0.85.0...v0.86.0

It is a good idea to try downgrading. I tried aider v0.85.0, but I've got the empty response on my 4th prompt and all the next ones.

As for your observation of aider not sending requests to gemini, I'm not sure about that. I spammed the same request that caused empty response 9 times and the dashboard in Google AI Studio reported at least 6 new requests to the model with at least 25k input tokens. Aider can have issues with sending requests, but Google receives at least some requests.

UPD: v0.84.0 also has this issue.

I still get the issue. Seems to be less common though. Usually when I've filled up my context or have added too many files the issue might happen. Using 0.85.0.

Interesting as concerns to seeing the requests. I'm using LiteLLM and LiteLLM isn't logging the request from aider (no fail, no pass), so I assumed the requests weren't being sent by aider.

szmania avatar Aug 14 '25 22:08 szmania

anyone taking note of the time when it doesn't work?

I've noticed that it tends to happen at 7-8am PDT, my queries around 6pm-9pm PDT seems ok for the past 2 days.

rebooting avatar Aug 15 '25 00:08 rebooting

exactly, i am using older version v0.85.0, i've auto update disabled as i don't need it.

When Gemini api gets overloaded it returns EMPTY responses. This issue is happening almost everyday for last few days after 11:30 am UTC and persists for 2-3 hours.

zerocorebeta avatar Aug 15 '25 04:08 zerocorebeta

I tried looking in Google Cloud. I saw in dashboard that the gemini API was returning responses with size 0 and status code 200 sometimes when I had the empty response message.

hahaslav avatar Aug 15 '25 06:08 hahaslav

Rolling back to 0.85.0 seems to really fix this issue (it still happens occasionally) for me more or less (at least its less trivial). Before the rollback I used to get the error probably on 60% of requests. Now I get it on about 1 out of 25 requests... which is manageable for me....

szmania avatar Aug 15 '25 17:08 szmania

I went ahead, and did this:

The message "Empty response received from LLM. Check your provider account?" appears to originate from two files:                  
aider/coders/base_coder.py and aider/io.py.                                                                                        

In aider/coders/base_coder.py it's on line 2690, and in aider/io.py it's on line 1088. 

Here's the plan:

1 Define EmptyLLMResponseError: Create a new exception class EmptyLLMResponseError in aider/exceptions.py.
2 Add ExInfo for EmptyLLMResponseError: Include an entry for this new exception in the EXCEPTIONS list within aider/exceptions.py, marking it as retry=True.
3 Register with LiteLLMExceptions: Modify the LiteLLMExceptions class to include this new custom exception in its exceptions
dictionary, so that get_ex_info can correctly retrieve its retry status.

By doing this, when EmptyLLMResponseError is raised, our system will know to attempt a retry.

zerocorebeta avatar Aug 18 '25 05:08 zerocorebeta

Also getting the same issue

pistachiomuncher avatar Aug 18 '25 11:08 pistachiomuncher