[BUG] Bug Report: Loading spinner freezes + no response, correlated with repeated "malformed tool call" retries
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?
Environment
- Claude Code version: 2.1.154
- Terminal: Apple Terminal (TERM=xterm-256color), macOS (Darwin 24.6.0)
- Custom statusline: claude-hud plugin (runs a TypeScript HUD via bun, configured in ~/.claude/settings.json)
- Relevant env in settings: MAX_THINKING_TOKENS=8000, CLAUDE_CODE_SUBAGENT_MODEL=haiku, DISABLE_NON_ESSENTIAL_MODEL_CALLS=1
- Model: Opus 4.8
Symptom (as reported by the user)
While the assistant is working, the loading animation (the spinner / ✻ Working… indicator) freezes, and the assistant produces no reply at all for the turn. The
user has to send another message ("what are you doing?") to find out the assistant is stuck. This used to work normally (spinner animated as expected); the
user noticed it stopped working recently.
Key evidence
Almost every assistant turn begins with an injected system message:
▎ Your tool call was malformed and could not be parsed. Please retry.
A concrete captured instance:
- The assistant issued a single Edit tool call (not parallel, no nested shell quoting).
- The edit succeeded (Added 2 lines, removed 1 line — confirmed in the diff shown in the UI).
- Immediately after, the UI showed ✻ Cogitated for 2m 5s — i.e. the turn hung for ~2 minutes 5 seconds.
- During that time the loading animation was frozen on one frame.
- The turn ended with no visible output to the user.
- The next turn again opened with Your tool call was malformed and could not be parsed. Please retry.
An earlier instance: the assistant issued 3 parallel Bash calls (with nested quotes / pipes). All 3 executed and returned output, but the turn ended with The
model's tool call could not be parsed (retry also failed), and the animation froze.
Analysis (most consistent hypothesis)
The two instances above show the freeze happens with both a single simple tool call and parallel calls — so "parallel calls / complex shell quoting" is not the
trigger (an earlier guess we ruled out).
The most explanatory hypothesis is a retry loop:
- The model emits a tool call the harness cannot parse (malformed).
- The harness auto-retries (re-generates the turn).
- Re-generation is malformed again → retry again …
- Each retry re-runs the full thinking + output (non-trivial with MAX_THINKING_TOKENS=8000), accumulating to the observed ~2 minutes.
- During this loop the loading spinner is not being repainted, so it appears frozen.
- After retries are exhausted, the turn yields no output to the user — which is exactly the "frozen + no reply" symptom.
In short: "spinner frozen + no reply" = the client is stuck in a "model emits malformed tool call → harness retries repeatedly" loop. It does not appear to be a
pure rendering issue, and toggling claude-hud was not required to explain it.
Open questions / what we could NOT confirm from inside the session
- Why the model produces a malformed tool call in the first place is not observable from the assistant's side (no access to the raw emitted token stream or the
harness parser details). This seems to be a client/harness-layer issue.
- It is unclear whether the malformed call is a trailing extra/partial tool-call block appended after a valid one, or a single corrupted block.
- Two possible secondary factors worth checking on your side: (a) interaction with a custom command-type statusline (claude-hud) repainting concurrently, (b)
whether long thinking (MAX_THINKING_TOKENS=8000) increases the chance of a truncated/malformed tool-call serialization.
Suggested things to check
- Whether the spinner/animation render loop keeps repainting during tool-call parse-retry cycles (it currently appears to stall).
- Whether a turn that exhausts tool-call parse retries can surface some user-visible error instead of silently producing no output.
- Repro signal: watch for turns that open with Your tool call was malformed and could not be parsed. Please retry. — these correlate with the freezes.
What Should Happen?
When the task is completed or if any problems occur, feedback should be provided in the form of prompts or errors. It is not acceptable to get stuck without any response.
Error Messages/Logs
No log was captured.
Steps to Reproduce
Occasional issues occur, but the probability of their occurrence is quite high. I still don't know the stable reproduction steps.
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
Claude Code version: 2.1.154
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗