[BUG] Cloudflare 520 error

Resolved 💬 4 comments Opened Jul 9, 2025 by lukehutch Closed Jan 13, 2026

Just got this on latest Claude Code, on macOS:


⏺ Read(kotlin/src/test/kotlin/com/bamboohr/clj_utils/MongoTest.kt)
  ⎿  Read 103 lines (ctrl+r to expand)
  ⎿  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 5 seconds… (attempt 4/10)
  ⎿  API Error (520 <!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en-US"> <![endif]-->
<!--[if IE 7]>    <html class="no-js ie7 oldie" lang="en-US"> <![endif]-->
<!--[if IE 8]>    <html class="no-js ie8 oldie" lang="en-US"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en-US"> <!--<![endif]-->
<head>


<title>api.anthropic.com | 520: Web server is returning an unknown error</title>
<meta charset="UTF-8" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta name="robots" content="noindex, nofollow" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link rel="stylesheet" id="cf_styles-css" href="/cdn-cgi/styles/main.css" />


</head>
<body>
[...]
     <p><span>There is an issue between Cloudflare's cache and your origin web server. Cloudflare monitors for these errors and automatically investigates the cause. To help support the investigation, you can pull the corresponding error log from your web server and submit it our support team.  Please include the Ray ID (which is at the bottom of this error page).</span> <a rel="noopener noreferrer" href="https://developers.cloudflare.com/support/troubleshooting/http-status-codes/cloudflare-5xx-errors/error-520/">Additional troubleshooting resources</a>.</p>
[...]
    </div>
</div>
</body>
</html>
) · Retrying in 10 seconds… (attempt 5/10)
  ⎿  API Error (Request timed out.) · Retrying in 17 seconds… (attempt 6/10)

It's obviously a CloudFlare reaction to an Anthropic API server timeout, but the Claude Code frontend should detect this and show something more meaningful, rather than dumping the raw HTML to the console.

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗