- Claude Code 2.1.334 answers a gateway's unrecognized 400 or 422 with two new retries: the same request again, then the request without the model's earlier thinking. With the retries 2.1.333 already made, one request my test gateway blocked for carrying an AWS key arrived eight times in 49 milliseconds.
- The status code decides it. A 400 or 422 got eight sends whatever the body said, and
x-should-retry: falsechanged nothing. A 403 or a 446 got one. - If your gateway blocks on content, every resend is another guardrail call. Against a guardrail that catches 90 percent per call, the key got through in 28 of 50 sessions on 2.1.334 and 8 of 50 with two environment variables set. Make verdicts sticky, or set both variables in managed settings.
Claude Code 2.1.334 reached npm at 18:55 UTC on 1 December. One line in its long changelog says that behind a gateway, "an unknown 400 or 422 is silently resent, then without earlier thinking."
The fix is for gateways that rewrite the API's error text. When Anthropic rejects a thinking signature and the gateway swaps the message for its own, Claude Code can't tell what went wrong, and the session stays stuck. 2.1.334 probes instead: it resends once in case the error was a fluke, then resend without the old thinking blocks to see if those were the problem.
The gateway docs name the catch themselves. They suggest turning the probe off if your gateway rejects requests under a content policy. I wanted to see what that looks like from the gateway's side.
The rig
A fake gateway in about 180 lines of Python on 127.0.0.1. It never forwards anything. It answers Claude Code like the Messages API, with a scripted model: the first reply thinks one sentence and calls Read on config.txt. That file holds aws_access_key_id = AKIAIOSFODNN7EXAMPLE, the example key from AWS's own docs.
When Claude Code sends the tool result back, the request now contains the key. The gateway rejects any request with that string: a 400 with the error envelope LiteLLM uses and a message I made up, "Violated guardrail policy: secret_detection."
Every run was claude -p with --model claude-sonnet-5-5, a dummy API key, a clean environment, a fresh config folder and no MCP servers. No request reached a real model, so the whole test cost nothing. I logged every request body and header.
Eight sends in 49 milliseconds
On 2.1.333 the blocked request arrived six times. On 2.1.334, eight. Diffing the bodies shows what each one is:
- The original request.
- The same bytes again. New in 2.1.334.
- The same request with the earlier thinking block removed. New in 2.1.334.
- The original again, minus the
thinking-token-countbeta header. - Minus a second beta header and the
thinking.displayfield. - Tool search switched off: nine deferred tools declared in full, a system message saying ToolSearch is gone, and the body up from 48.7 KB to 78.5 KB.
Sends 7 and 8 repeat the two beta-header guesses on that bigger body.
Sends 4 to 8 come from older recovery logic. Claude Code guesses which beta value a gateway might have rejected, then tries the request without tool search. Per the docs, the tool search retry dates from 2.1.305 and most of the beta guesses from 2.1.314. 2.1.334 put two more sends in front of them.
There is no backoff between any of them. All eight arrived within 49 ms. The developer sees one error, now followed by a new line: "If other sessions work and this one keeps failing, start a new session."
What changes the count
I ran the same blocked request with one thing changed at a time. The count is how often the request with the key reached the gateway.
| Setup | 2.1.333 | 2.1.334 |
|---|---|---|
| 400, LiteLLM-style JSON body | 6 | 8 |
| 422 | 6 | 8 |
| 400, plain-text body | not run | 8 |
400, Anthropic-shaped invalid_request_error |
not run | 8 |
400 with x-should-retry: false |
not run | 8 |
| Same test on Haiku 5.5 | not run | 8 |
| Key in the first prompt, no earlier thinking | 6 | 6 |
CLAUDE_CODE_DISABLE_REPLAYED_THINKING_PROBE=1 |
not run | 6 |
CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 |
not run | 3 |
| Both variables | not run | 1 |
| 403 | 1 | 1 |
| 446 | not run | 1 |
The body doesn't matter: JSON, plain text and Anthropic's own error shape all got eight. The x-should-retry header, which the docs describe as marking a response not retryable, has no effect on these retries. And the new probe only runs when the conversation already has thinking in it. A key in the very first prompt got six sends on both versions.
A 403 stops at one send, but Claude Code then tells the developer "Failed to authenticate", which is the wrong story for a DLP block.
When the guardrail isn't sure
A regex secret scanner blocks all eight sends. A guardrail that is itself a model is different. If its verdict on a resend is a fresh draw, every resend is another chance to get through.
I set the gateway to block each send with a probability of 0.9, seeded per run, and ran 50 sessions per setup:
| Setup | Sessions where the key got through | Expected |
|---|---|---|
| 2.1.333 | 24 of 50 | 47% |
| 2.1.334 | 28 of 50 | 57% |
| 2.1.334, both variables set | 8 of 50 | 10% |
A guardrail that catches nine in ten requests caught roughly half the sessions. When a retry got through, the run ended with a normal answer, "The region is eu-west-1.", a success result, no error event in the stream and nothing on stderr. The developer never learns a guardrail fired.
What to do about it
If you run the gateway:
- Count blocks per request, not per log line. One blocked tool result can be eight lines, and eight guardrail calls if your guardrail bills per call.
- Make the verdict sticky. Cache it on a hash of the content that tripped it, such as the tool result text, so a resend of the same content gets the same answer. Hashing the whole body won't work, because sends 3, 5 and 6 change it.
- Change the status. In my runs a 403 and a 446 each stopped at one send; I didn't try other codes, and 429s and 5xx errors have their own retries with backoff. Check what your clients show before you switch, since a 403 reads as an auth failure.
If you manage the developers' machines, put both variables in the env block of your managed settings: CLAUDE_CODE_DISABLE_REPLAYED_THINKING_PROBE=1 and CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1. That brought it to one send in my runs.
Both switches cost something. The beta switch turns off tool search, so tools go out in full on every request. In my rig, with no MCP servers at all, the request grew from 48 KB to 77 KB. And a session that the probe would have rescued from a rejected thinking signature stays broken until the developer starts a new one.
What I didn't test
Interactive sessions, the desktop app and IDE extensions. Real gateway products: I borrowed LiteLLM's error envelope, not LiteLLM. Sessions with MCP servers, Opus and Fable models, and the Bedrock and Agent Platform request formats. A direct connection to Anthropic, where the docs say the probe doesn't run. What later requests look like after the no-thinking retry is accepted; the docs say the old thinking stays out for the rest of the session.


