opencode icon indicating copy to clipboard operation
opencode copied to clipboard

AI_RetryError: Failed after 4 attempts. Last error: Too Many Requests

Open andreluisos opened this issue 4 months ago • 7 comments

I've searched around and this seems to be related to provider. Anyone else? #2018 #2116

andreluisos avatar Sep 03 '25 15:09 andreluisos

This issue might be a duplicate of existing issues. Please check:

  • #2018: Very similar AI_RetryError with "Failed after 4 attempts" and "Provider returned error" - also mentions provider-related issues
  • #2244: Rate limiting issue with "rate_limit_exceeded" - similar retry/rate limiting symptoms
  • #2245: AI_APICallError with OpenRouter provider - related to provider authentication/API issues

Feel free to ignore if none of these address your specific case.

github-actions[bot] avatar Sep 03 '25 15:09 github-actions[bot]

What provider are you using?

rekram1-node avatar Sep 03 '25 16:09 rekram1-node

What provider are you using?

Copilot and claude.

Nevermind... Only copilot is having the issue. Probaly provider issue.

andreluisos avatar Sep 03 '25 16:09 andreluisos

You may be getting rate limited? 2 things:

  • check your copilot dashboard
  • you can try opencode auth logout and log back in again

rekram1-node avatar Sep 03 '25 16:09 rekram1-node

we can also try looking at your logs

rekram1-node avatar Sep 03 '25 16:09 rekram1-node

@andreluisos can you confirm this is still happening? I recall seeing something similar, but it was a while ago, and nothing since the (subsequent) latest update.

thoroc avatar Sep 17 '25 00:09 thoroc

I now (v1.0.126) experience OC (apparently) spamming X.ai to the point where I see the red error message "Too many requests..."

Trying to divine what is happening from the logs is either neigh impossible... or I'm holding the wrong chicken and standing on the wrong leg - @rekram1-node any hints on where in the logs we can find what is happening?

taqtiqa-mark avatar Dec 02 '25 07:12 taqtiqa-mark

@taqtiqa-mark what kind of logs are you looking for exactly? when you get 429s we continue to retry but with a backoff that respects the retry-after ratelimiting headers

The retry message you see is taken directly from the response from the server, or it should be

rekram1-node avatar Dec 02 '25 17:12 rekram1-node

@taqtiqa-mark what kind of logs are you looking for exactly?

Ideally the full transcript of the API (pre-encryption/HTTPS) messages sent/received. There is no way my message submissions triggered a rate limit violation, 10-20 messages tops across a couple of new sessions.

I also have a sneeking suspicion about what happens when OC chokes on the the XML parsing (mentioned in other issues), so it'd be nice to see the logs of that too.

taqtiqa-mark avatar Dec 02 '25 19:12 taqtiqa-mark

@taqtiqa-mark what kind of logs are you looking for exactly?

@rekram1-node progress is probably blocked by issue #4999 ?

taqtiqa-mark avatar Dec 02 '25 22:12 taqtiqa-mark