[Bug] Anthropic API Error: Connection closed mid-response during security analysis—undiagnosable policy intervention
Bug Description
I run Claude Code (Fable 5) on my own codebase, a multi-dealer commerce
platform. I asked it to run a routine security pass over MY OWN repo:
access-control review, tenant-scoping, input validation on my own server
actions. Standard defensive hardening of code I own and am authorized to
The run died twice with "API Error: Connection closed mid-response" —
both times at the exact moment the scan was about to persist its security
findings to disk. That timing is not what a random network blip looks like.
It looks like an intervention terminating the stream when security content
is about to materialize.
Two problems, and the second is the real one:
1. FALSE POSITIVE ON FIRST-PARTY DEFENSIVE WORK. The safeguard appears to
key on security vocabulary (SSRF, auth-bypass, tenant isolation, PII)
rather than intent or ownership. Reviewing and hardening your own
authorized code is the single most legitimate security activity there is,
and it's exactly the high-stakes reasoning I'm paying for Fable to do.
Bouncing it is backwards.
2. IT'S UNDIAGNOSABLE. If a safety mechanism is terminating the response,
surfacing it as "connection closed mid-response" is the worst possible
failure mode. I can't tell a policy intervention from a transport error,
can't appeal it, can't adjust, and waste tokens retrying something that
was never going to complete. If the model won't do something, say so
plainly with a reason. Don't dress a refusal up as an infrastructure
fault.
What I want: (a) ownership/intent context should gate this, not keyword
matching — first-party authorized defensive work should pass; (b) if an
intervention DOES fire, return an explicit, labeled signal, never a fake
network error. Silent mid-stream termination that mimics a transport
failure is unacceptable in a paid coding tool.
This burned tokens, split my task across retries, and interrupted exactly
the work Fable is best suited for.
Environment Info
- Platform: darwin
- Terminal: WarpTerminal
- Version: 2.1.226
- Feedback ID: e7d7bfab-455e-456a-9ee4-59e0c449d36a
Errors
[]