[BUG] API Error: Connection closed mid-response causes truncated/empty responses
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When running Claude Code in an existing project, responses frequently cut off with "API Error: Connection closed mid-response. The response above may be incomplete." This happens repeatedly across multiple tool calls (Bash, Read) within the same session — sometimes producing responses that are just a single character ("I") before erroring out. Separately, one session also hit "Failed to authenticate. API Error: 403 Request not allowed" before any response was generated.
What Should Happen?
Claude Code should complete responses and tool calls without the connection dropping mid-stream, and authentication should succeed without a 403 error.
Error Messages/Logs
API Error: Connection closed mid-response. The response above may be incomplete.
Failed to authenticate. API Error: 403 Request not allowed
Steps to Reproduce
- Open a project directory (e.g. d:/Project/Freelancer/Python/IBKR) in Claude Code
- Ask: "let me know about main idea's this project."
- Claude begins responding, runs ls -la and Read README.md
- Mid-response, the error "API Error: Connection closed mid-response" appears repeatedly, truncating output to single characters
- Typing "continue" does not fully resolve it — the error recurs after subsequent tool calls
Note: On a separate occasion, the same prompt instead failed at the very first step with "Failed to authenticate. API Error: 403 Request not allowed"
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
2.1.220
Claude Code Version
2.1.223
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
VS Code integrated terminal
Additional Information
Attach the two screenshots showing the error sequence. Errors occurred in a project.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗