Frequent 504 Gateway Timeout errors from api.anthropic.com
Description
Experiencing frequent and random 504 Gateway Timeout errors when using Claude Code, which significantly impacts productivity.
Error Details
API Error (api.anthropic.com | 504: Gateway time-out) · Retrying in 5 seconds… (attempt 4/10)
⎿ API Error (api.anthropic.com | 504: Gateway time-out) · Retrying in 9 seconds… (attempt 5/10)
⎿ API Error (api.anthropic.com | 504: Gateway time-out) · Retrying in 16 seconds… (attempt 6/10)
⎿ API Error (api.anthropic.com | 504: Gateway time-out) · Retrying in 35 seconds… (attempt 7/10)
⎿ API Error (api.anthropic.com | 504: Gateway time-out) · Retrying in 34 seconds… (attempt 8/10)
I'm now having difficulty recovering my session, even after the agent responded:
<img width="965" height="380" alt="Image" src="https://github.com/user-attachments/assets/2b37139f-2b45-4ee0-9f45-4c647f9f8672" />
Frequency
These errors occur randomly during normal usage, often requiring multiple retry attempts before succeeding.
Impact
- Interrupts workflow
- Causes delays in development
- Sometimes requires 8+ retry attempts
Environment
- Claude Code CLI
- Platform: macOS (Darwin 23.5.0)
- Date observed: 2025-08-29
Expected Behavior
API calls should complete successfully without frequent gateway timeouts.
Additional Context
The retry mechanism does eventually succeed in most cases, but the frequency of these errors suggests there may be an infrastructure or rate limiting issue that needs investigation.
Workaround:
I was able to recover my session task by asking the agent to break out the output file into seperate smaller files.
<img width="1362" height="200" alt="Image" src="https://github.com/user-attachments/assets/2ba8c65f-be5a-4ec5-a251-261ab33bb20c" />
I got it to write one file, but now it's stuck again:
<img width="612" height="53" alt="Image" src="https://github.com/user-attachments/assets/bf1940c4-9830-4819-9088-06374cc6d538" />
Here's a screenshot of my current context usage for whomever at anthropic works on debugging this issue:
<img width="846" height="280" alt="Image" src="https://github.com/user-attachments/assets/69dc97e5-19e0-4e7c-8b7a-e3dc2c3191f6" />
14 Comments
Same here. It starts out working ok but as context length grows I run into these errors. I think #6781 is the same issue.
Found 1 possible duplicate issue:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
same here. It started from 6pm EST onwards. very confusing and frustrating. Just reached out to support team but haven't got any feedback
For more context:
<img width="796" height="835" alt="Image" src="https://github.com/user-attachments/assets/2e26b4e7-a929-4788-943f-1261b737da01" />
https://status.anthropic.com/ not showing any outages.
same here
Full Context
<img width="1029" height="864" alt="Image" src="https://github.com/user-attachments/assets/9cc17b7f-a529-4714-981d-20fb76754df5" />
<img width="1059" height="800" alt="Image" src="https://github.com/user-attachments/assets/7f546f4c-df46-47c6-81ea-44fe7f0edab1" />
Same here
So, here is what happened, after the error I hit:
<img width="722" height="337" alt="Image" src="https://github.com/user-attachments/assets/f30cf7fe-91c6-465b-9658-21f49fd28f46" />
Not sure if this has anything to do with it, but they just updated their status page:
<img width="879" height="247" alt="Image" src="https://github.com/user-attachments/assets/87527e43-ea0c-4af6-98b9-985457230005" />
I think it's resolved and working fine for me now.
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.
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.