[BUG] 2.1.183: pre-first-byte streaming aborts on custom ANTHROPIC_BASE_URL (proxy/gateway), large-context — regression from 2.1.179 (2.1.181 unaffected on the gateway)

Status Open
Reported on v2.1.181
Maintainer reply None cached
Activity 3 comments · opened Jun 20, 2026

Preflight Checklist

  • [x] I have searched existing issues
  • [x] This is a single bug report
  • [x] I am using the latest version of Claude Code

What's Wrong?

On a custom ANTHROPIC_BASE_URL (a corporate LiteLLM proxy fronting Bedrock / the Anthropic API), large-context turns (≈150k–500k input tokens) intermittently fail before the first response byte starting with 2.1.181 (and 2.1.182 / 2.1.183). Users see an "API error / no response from API" pause and the client retries.

At the load balancer in front of the proxy, these failures show up as HTTP 460 (client closed the connection before the target responded; target_processing_time = -1) — i.e. the client is aborting before the first byte arrives, not the server erroring.

We isolated this fairly carefully and believe it is client-side:

  • Backend is healthy. Independent streaming probes through the same proxy return the first SSE byte in 13–20 s even cache-cold at ~360k tokens; the upstream provider reports full rate-limit headroom (no throttling). So the gateway is delivering first byte well within any reasonable timeout.
  • The aborts are concentrated on the largest-context users and only on clients pointed at a custom ANTHROPIC_BASE_URL — direct-API clients in the same org are unaffected.
  • This started exactly when clients auto-updated into the 2.1.181→2.1.183 range (latest advanced to 2.1.183 on 2026-06-19, matching onset).

The 2.1.181 changelog includes: "Fixed prompt caching not reading on custom ANTHROPIC_BASE_URL … due to a per-request attestation token changing every turn." That code path only affects custom-base-URL clients, which matches exactly who is and isn't impacted here — so it seems like a strong candidate for where the regression was introduced.

What Should Happen?

The client should wait for the first byte up to its configured request/idle timeout and not abort large-context streaming requests prematurely on a custom ANTHROPIC_BASE_URL.

Error Messages/Logs

# client side: "API error" / "No response from API" pause + retry
# load balancer (in front of the proxy): HTTP 460, request_processing_time≈0.001, target_processing_time=-1
#   -> client closed the connection before the proxy sent any response byte

Steps to Reproduce

  1. Point Claude Code at a custom ANTHROPIC_BASE_URL (e.g. a LiteLLM proxy) on 2.1.181–2.1.183.
  2. Drive a session with a large accumulated context (~150k–500k input tokens), streaming.
  3. Observe intermittent pre-first-byte aborts on the heavy turns (visible as HTTP 460 at the LB) that do not occur on 2.1.179.

Claude Model

Sonnet 4.6 and Opus 4.8 (via the proxy)

Is this a regression?

Yes, this worked in a previous version

Last Working Version

2.1.179

Claude Code Version

2.1.181, 2.1.182, 2.1.183

Platform

Custom ANTHROPIC_BASE_URL (LiteLLM proxy → Bedrock / Anthropic API)

Operating System

Linux / WSL2

Additional Information

  • Almost certainly the same regression as #69358 ("No Response From API 2.1.181, 2.1.183", last working 2.1.179) and #69660 (intermittent "No response from API", 2.1.183, started mid-session 2026-06-19). Filing separately because this report isolates the custom-ANTHROPIC_BASE_URL / proxy manifestation and ties it to the 2.1.181 attestation-token / prompt-cache change. Possibly related: #66095 and #64533 (slow / multi-minute first-byte).
  • Workaround that fixes it for us: pin to 2.1.179 (npm install -g @anthropic-ai/claude-code@2.1.179, or native installer ... | bash -s 2.1.179) and set DISABLE_AUTOUPDATER=1 so the background updater doesn't re-bump past it.
  • Happy to provide anonymized LB/timing captures if useful.

View original on GitHub ↗

3 Comments

bse-ai · 2 months ago

Update — stratified our gateway traffic by client version, and it narrows this to 2.1.183 specifically (not 2.1.181).

I pulled load-balancer access logs in front of the proxy across 2026-06-16 → 06-20 and computed the pre-first-byte abort rate (LB HTTP 460, target_processing_time = -1) per claude-cli/<version> from the User-Agent. Same gateway, same backend window, so backend state is held constant across versions:

| client version | requests | 460 (pre-first-byte aborts) | rate |
|---|---:|---:|---:|
| 2.1.176 | 3,071 | 3 | 0.1% |
| 2.1.177 | 2,249 | 9 | 0.4% |
| 2.1.178 | 8,363 | 90 | 1.1% |
| 2.1.179 | 22,774 | 127 | 0.6% |
| 2.1.181 | 8,639 | 60 | 0.7% |
| 2.1.183 | 1,364 | 128 | 9.4% |
| non-claude-cli (other clients, same LB) | 39,268 | 47 | 0.1% |

Everything through 2.1.181 sits at baseline (~0.1–1.1%); 2.1.183 jumps ~13×. Notably 2.1.181 is indistinguishable from 2.1.179.

Same-user control (removes the "version correlates with who/what" confound): one heavy large-context user, same workload, across the version change:

| date | client version | 460 / total |
|---|---|---:|
| 06-18 | 2.1.181 | 0 / 30 (0%) |
| 06-19 | 2.1.183 | 7 / 11 (64%) |
| 06-20 | 2.1.183 | 11 / 50 (22%) |

The same user went from 0% on 2.1.181 to 64% on 2.1.183 with nothing changing but the client version. A second heavy user shows the same once on 2.1.183 (7/12), and 0/95 while on 2.1.179.

Takeaways:

  • On a custom ANTHROPIC_BASE_URL, the pre-first-byte abort regression is 2.1.183-specific. The matching changelog line is 2.1.183's "Fixed mid-stream connection drops: partial responses are now preserved instead of showing a raw error" — a streaming-path change — rather than the 2.1.181 attestation/prompt-cache change I speculated about in the original report.
  • This looks distinct from the 2.1.181 reports in #69358 (which are "No Response From API" on the direct API). Two overlapping regressions on different surfaces.
  • Workaround unchanged and confirmed: pinning to 2.1.179 takes the heavy users back to 0%.
Necmttn · 2 months ago

Pre-first-byte aborts need request-attempt receipts. For each streaming call, record client version, base URL class, input token estimate, request id/hash, first-byte deadline, abort source, retry count, and load-balancer close code when available. That makes large-context proxy regressions comparable across versions without exposing prompt content.

---

_Generated with ax._

pplar39 · 1 month ago

Adding a related data point for a later version.

I'm using Claude Code 2.1.207 with a custom ANTHROPIC_BASE_URL pointing to a non-Anthropic API endpoint, and the client fails during startup/connection with what appears to be URL/endpoint validation. Rolling back to 2.1.181 makes it work again.

Environment:

  • Claude Code: 2.1.207 (broken) → 2.1.181 (working)
  • OS: Linux
  • Auth method: ANTHROPIC_AUTH_TOKEN
  • ANTHROPIC_BASE_URL: https://api.<redacted>/coding/

Symptom:

  • 2.1.207: fails immediately with endpoint-related checks
  • 2.1.181: works normally

This suggests the custom-base-URL code path got more restrictive validation after 2.1.181, beyond the pre-first-byte abort described in the main report.