[BUG] API Error: Overloaded should automatically retry w/ backoff

Status Fixed / completed
Maintainer reply None cached
Activity 11 comments · opened Mar 21, 2025 · closed Mar 24, 2025

Environment

  • Platform (select one):
  • [X] Google Vertex AI
  • Claude CLI version: 0.2.52 (Claude Code)
  • Operating System: macOS 15.3.1
  • Terminal: iTerm2

Bug Description

I frequently get: API Error: {"type":"error","error":{"details":null,"type":"overloaded_error","message":"Overloaded"} } which interrupts flow and requires me to submit another prompt to get Claude Code to continue whatever it was doing.

Expected Behavior

It would be far better if the Overloaded error was treated as a retriable one, possibly with exponential backoff, to allow the overload condition to clear without requiring human input on my part.

Actual Behavior

I have to type something (I usually just do c) to get it to continue.

View original on GitHub ↗

11 Comments

scottleibrand · 1 year ago

Looks like this behavior was just improved/fixed today in 0.2.53 (Claude Code):

  ⎿  API Error ({"type":"error","error":{"details":null,"type":"overloaded_error","message":"Overloaded"}           }) · Retrying in 1 seconds… (attempt 1/10)
  ⎿  API Error ({"type":"error","error":{"details":null,"type":"overloaded_error","message":"Overloaded"}             }) · Retrying in 1 seconds… (attempt 1/10)
scottleibrand · 1 year ago

Confirmed that for API Error (Request timed out.) it does exponential backoff starting with the second retry, maxing out at 32 seconds:

  ⎿  API Error (Request timed out.) · Retrying in 1 seconds… (attempt 1/10)
  ⎿  API Error (Request timed out.) · Retrying in 1 seconds… (attempt 2/10)
  ⎿  API Error (Request timed out.) · Retrying in 2 seconds… (attempt 3/10)
  ⎿  API Error (Request timed out.) · Retrying in 4 seconds… (attempt 4/10)
  ⎿  API Error (Request timed out.) · Retrying in 8 seconds… (attempt 5/10)
  ⎿  API Error (Request timed out.) · Retrying in 16 seconds… (attempt 6/10)
  ⎿  API Error (Request timed out.) · Retrying in 32 seconds… (attempt 7/10)
  ⎿  API Error (Request timed out.) · Retrying in 32 seconds… (attempt 8/10)
  ⎿  API Error (Request timed out.) · Retrying in 32 seconds… (attempt 9/10)
  ⎿  API Error (Request timed out.) · Retrying in 32 seconds… (attempt 10/10)
  ⎿  API Error: Request timed out.

presumably Overloaded would behave similarly.

reverie · 1 year ago

Thanks @scottleibrand. Yep, this is fixed in the latest version. Please reopen this ticket if you run into the problem again.

santoshgistto · 1 year ago

Still i see the issue

{"type":"error","error":{"details":null,"type":"overloaded_error","message":"Overloaded"}
scottleibrand · 1 year ago

Overloaded errors should still occur. But on never versions it will automatically retry. What version are you on?

plucked · 1 year ago

Not retrying in the latest version 0.2.56 when overload error occurs

scottleibrand · 1 year ago

Strange. It's working reliably for me. Maybe open a new issue with screenshots?

scottleibrand · 1 year ago

Now I'm seeing the same thing @plucked is. Perhaps they removed the automatic retry in a version between 0.2.53 and 0.2.56? I don't have perms to reopen this one, so I'll open a new issue.

scottleibrand · 1 year ago

As I just noted at https://github.com/anthropics/claude-code/issues/661#issuecomment-2765362697:

A workaround for this is:

npm i -g @anthropic-ai/claude-code@0.2.55 && claude

I successfully downgraded to 0.2.55 with that and automatic API retries are working again on the newly downgraded session as well.

LinarAI · 1 year ago

<img width="1222" height="531" alt="Image" src="https://github.com/user-attachments/assets/de62b919-1554-441a-b8b6-d064a54a5c48" />
keep API Error, when will fix this? most of the time is retrying API Error

github-actions[bot] · 1 year ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.