
A 61% error rate that wasn’t really an error rate
One of our clients runs scoring calls through a proxy we built in front of the Claude CLI — the command-line tool for Anthropic’s models. The dashboard said 61% of those calls were failing with a generic 502 api_error. That number is alarming on its own. What made it worse is that it was lying about what kind of failure it was.
A 502 says “something upstream went wrong.” The reasonable response to a 502 is to retry — the server was overloaded, a connection dropped, it’ll probably work next time. So that’s what was happening: the client retried, got the same 502, retried again, and burned through attempts on requests that could never succeed.
Because the real cause wasn’t a server problem at all. The CLI was refusing specific prompts on usage-policy grounds — returning text like “usage policy” and “unable to respond to this request.” A refusal is a decision, not a hiccup. Retrying the identical input gets you the identical refusal, every time. We were paying for retries that were mathematically guaranteed to fail.
Why two opposite failures looked identical
This is the trap, and it’s worth naming precisely because it’s easy to walk into. When you wrap a third-party API or CLI, you usually have one catch-all path for “the call didn’t return a clean answer.” Transient overload, a dropped connection, a malformed response, a policy refusal — they all fall through to the same 502 api_error.
From the outside, a policy refusal and a transient server error are indistinguishable as a bare 502. But they are opposites in the one dimension that matters for what you do next:
- A transient error is non-deterministic and retryable. Retrying is exactly the right move.
- A policy refusal is deterministic and permanently non-retryable on the same input. Retrying is the exact wrong move.
Collapse them into one bucket and you get two separate failures at once. You waste client retries on requests that will never clear. And your “error rate” metric becomes meaningless — 61% looks like an infrastructure crisis when a large chunk of it is the model doing exactly what its policy says it should.
The fix: name the refusal and log who got refused
The change itself is small. We added a dedicated refusal_error type, separate from the catch-all api_error, triggered when the CLI’s response matches the usage-policy language. On each refusal we now log three things: the model, the prompt length, and the prompt’s first line.
Those three fields do two jobs.
First, they let downstream clients route instead of retry. A refusal_error is a signal to send that request to another provider — not to throw it back at the same CLI and hope. The retry logic stops wasting attempts on a closed door.
Second, the first-line-of-prompt log lets the team tell apart two kinds of refusal that also look identical until you inspect them:
- Content-triggered refusals — some specific articles trip the policy, most don’t. You’ll see refusals scattered across certain inputs.
- Account-level refusals — everything gets refused. That’s a different problem with a different owner.
Without the prompt context, both just read as “refused,” and you can’t tell whether you have a handful of awkward documents or an account in trouble.
The transferable lesson
If you wrap anything — an LLM CLI, a payments API, a third-party scraper — audit your error buckets for semantically opposite failures hiding under one code. The question to ask is blunt: for each thing in this bucket, is the correct next action to retry, or to stop? If the answer isn’t the same for everything in the bucket, the bucket is wrong.
The cost of getting this wrong isn’t just wasted retries, though that’s real money. It’s that your error metric stops meaning anything. A headline “61% error rate” that’s actually a mix of genuine outages and routine policy refusals will send you chasing an infrastructure problem that doesn’t exist — while the real signal, how often your content is being refused and whether it’s content or account driven, stays invisible.
Name the refusal. Log enough to tell which refusal it is. Then your retry logic and your dashboards can both start telling the truth.











