claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[BUG] Constant API Error and request timeouts

Open alexmocanu opened this issue 6 months ago • 10 comments

Environment

  • Platform (select one):
    • [ ] Anthropic API
    • [ ] AWS Bedrock
    • [ ] Google Vertex AI
    • [x] Other: Claude code
  • Claude CLI version: 1.0.21
  • Operating System: Ubuntu 24.04
  • Terminal: Gnome Terminal

Bug Description

This is what I keep getting today after one prompt:

⎿ 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 9 seconds… (attempt 5/10) ⎿ API Error (Request timed out.) · Retrying in 20 seconds… (attempt 6/10) ⎿ API Error (Request timed out.) · Retrying in 37 seconds… (attempt 7/10) ⎿ API Error (Request timed out.) · Retrying in 36 seconds… (attempt 8/10) ⎿ API Error (Request timed out.) · Retrying in 37 seconds… (attempt 9/10) ⎿ API Error (Request timed out.) · Retrying in 37 seconds… (attempt 10/10) ⎿  API Error: Request timed out.

After this it stays offline permanently.

Steps to Reproduce

  1. Start Claude Code
  2. Write a 10-15 lines prompt
  3. Wait forever.

Expected Behavior

I expect it to work.

Actual Behavior

It's timed out and now it's permanently offline

Additional Context

Should I continue paying for this, upgrade to a more expensive plan or switch to something that actually works?

I got better results running local stuff with Ollama for free.

alexmocanu avatar Jun 12 '25 12:06 alexmocanu

I think is the same problem that is making Claude Code unusable for days now.

Image

Emasoft avatar Jun 16 '25 13:06 Emasoft

Im cancelling my subscription and getting a key on openrouter. ffs

dreamy32 avatar Jun 16 '25 16:06 dreamy32

Im cancelling my subscription and getting a key on openrouter. ffs

How to cancel my subscription? I want to do it too.

hwuscut avatar Jun 19 '25 02:06 hwuscut

the problem is "env": { "MAX_THINKING_TOKENS": "32000" } , remove it

furkancak1r avatar Jun 19 '25 07:06 furkancak1r

"env": { "MAX_THINKING_TOKENS": "32000" }

Where can we find the "env": { "MAX_THINKING_TOKENS": "32000" }? Thanks.

hwuscut avatar Jun 19 '25 07:06 hwuscut

"env": { "MAX_THINKING_TOKENS": "32000" }

Where can we find the "env": { "MAX_THINKING_TOKENS": "32000" }? Thanks.

.claude>settings.local.json if you have "env": { "MAX_THINKING_TOKENS": "32000" } delete it

furkancak1r avatar Jun 19 '25 07:06 furkancak1r

"env": { "MAX_THINKING_TOKENS": "32000" }

Where can we find the "env": { "MAX_THINKING_TOKENS": "32000" }? Thanks.

.claude>settings.local.json if you have "env": { "MAX_THINKING_TOKENS": "32000" } delete it

I do not config the settings.local.json. I change the workplace to an empty one. Then start claude. The problem still exists. cwd: /home

⎿ 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 10 seconds… (attempt 5/10) ⎿ API Error (Request timed out.) · Retrying in 20 seconds… (attempt 6/10) ⎿ API Error (Request timed out.) · Retrying in 33 seconds… (attempt 7/10) ⎿ API Error (Request timed out.) · Retrying in 36 seconds… (attempt 8/10) ⎿ API Error (Request timed out.) · Retrying in 37 seconds… (attempt 9/10) ⎿ API Error (Request timed out.) · Retrying in 39 seconds… (attempt 10/10) ⎿ API Error: Request timed out.

hwuscut avatar Jun 19 '25 08:06 hwuscut

"env": { "MAX_THINKING_TOKENS": "32000" }

Where can we find the "env": { "MAX_THINKING_TOKENS": "32000" }? Thanks.

.claude>settings.local.json if you have "env": { "MAX_THINKING_TOKENS": "32000" } delete it

I do not config the settings.local.json. I change the workplace to an empty one. Then start claude. The problem still exists. cwd: /home

⎿ 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 10 seconds… (attempt 5/10) ⎿ API Error (Request timed out.) · Retrying in 20 seconds… (attempt 6/10) ⎿ API Error (Request timed out.) · Retrying in 33 seconds… (attempt 7/10) ⎿ API Error (Request timed out.) · Retrying in 36 seconds… (attempt 8/10) ⎿ API Error (Request timed out.) · Retrying in 37 seconds… (attempt 9/10) ⎿ API Error (Request timed out.) · Retrying in 39 seconds… (attempt 10/10) ⎿ API Error: Request timed out.

Maybe you should create an empty settings.local.json inside .claude folder, or try /logout

furkancak1r avatar Jun 19 '25 08:06 furkancak1r

create an empty settings.local.json

"env": { "MAX_THINKING_TOKENS": "32000" }

Where can we find the "env": { "MAX_THINKING_TOKENS": "32000" }? Thanks.

.claude>settings.local.json if you have "env": { "MAX_THINKING_TOKENS": "32000" } delete it

I do not config the settings.local.json. I change the workplace to an empty one. Then start claude. The problem still exists. cwd: /home ⎿ 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 10 seconds… (attempt 5/10) ⎿ API Error (Request timed out.) · Retrying in 20 seconds… (attempt 6/10) ⎿ API Error (Request timed out.) · Retrying in 33 seconds… (attempt 7/10) ⎿ API Error (Request timed out.) · Retrying in 36 seconds… (attempt 8/10) ⎿ API Error (Request timed out.) · Retrying in 37 seconds… (attempt 9/10) ⎿ API Error (Request timed out.) · Retrying in 39 seconds… (attempt 10/10) ⎿ API Error: Request timed out.

Maybe you should create an empty settings.local.json inside .claude folder, or try /logout

The above methods do not work either.

hwuscut avatar Jun 19 '25 08:06 hwuscut

create an empty settings.local.json

"env": { "MAX_THINKING_TOKENS": "32000" }

Where can we find the "env": { "MAX_THINKING_TOKENS": "32000" }? Thanks.

.claude>settings.local.json if you have "env": { "MAX_THINKING_TOKENS": "32000" } delete it

I do not config the settings.local.json. I change the workplace to an empty one. Then start claude. The problem still exists. cwd: /home ⎿ 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 10 seconds… (attempt 5/10) ⎿ API Error (Request timed out.) · Retrying in 20 seconds… (attempt 6/10) ⎿ API Error (Request timed out.) · Retrying in 33 seconds… (attempt 7/10) ⎿ API Error (Request timed out.) · Retrying in 36 seconds… (attempt 8/10) ⎿ API Error (Request timed out.) · Retrying in 37 seconds… (attempt 9/10) ⎿ API Error (Request timed out.) · Retrying in 39 seconds… (attempt 10/10) ⎿ API Error: Request timed out.

Maybe you should create an empty settings.local.json inside .claude folder, or try /logout

The above methods do not work either.

Sorry to hear that I don't know any other options

furkancak1r avatar Jun 19 '25 08:06 furkancak1r

From Anthropic Support to me:

"The timeout issues with long todo lists appear to be related to the extended processing time required for complex multi-step tasks, which can exceed the default API timeout limits. As a workaround, you can increase the API timeout by setting the API_TIMEOUT_MS environment variable before launching Claude Code. For example, you can use the export API_TIMEOUT_MS=600000 command to set it for 10 minutes. The default appears to be 30 seconds (30000ms), but you can increase it significantly for complex tasks like long todo lists."

This worked for me personally.

NellInc avatar Jul 06 '25 16:07 NellInc

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.

github-actions[bot] avatar Aug 04 '25 14:08 github-actions[bot]