[BUG] Claude Code Hangs Indefinitely After Turn Completion with Queued Items
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?
Claude Code hangs indefinitely in "thinking" state after completing a turn when there are queued task notifications waiting to be processed. The hang persists until user intervention (pressing Escape twice). This has occurred multiple times.
Actual Behavior
After turn completion:
- System logs
turn_durationnormally - Queue processing stops entirely
- UI shows "thinking" state indefinitely
- 8 completed task notifications sat in queue for 5 hours 31 minutes
- No errors logged, no timeout, no recovery
- Only user intervention (Escape key) resumed processing
Key Observations
stop_reason: nullin the last assistant message before hang (unusual - should beend_turnor similar)- No errors in logs - no API errors, no exceptions, no timeouts
- Queue had items - 8 enqueue operations occurred, but no dequeue until user intervention
- Immediate recovery - Pressing Escape twice immediately resumed normal operation
- Recurring issue - User reports this has happened multiple times
Related Issues
These issues describe similar but distinct hang/freeze behaviors:
| Issue | Title | Similarity |
|-------|-------|------------|
| #13224 | Claude Code hangs or freezes during execution with no recovery mechanism | General hang behavior, no recovery |
| #13198 | Multiple concurrent Claude Code terminals hang after 2 hours with repeated token usage | Multi-terminal hang, time-based trigger |
| #13188 | Sessions become unresponsive after upgrade to 2.0.60 (suspected background agent blocking) | Background agent blocking - most similar |
Note: Issue #13188 appears most related as it specifically mentions "background agent blocking" which aligns with this report's findings (8 background agents completing while main session hung).
What Should Happen?
Expected Behavior
After a turn completes (turn_duration logged), Claude Code should:
- Check the notification queue for pending items
- Dequeue and process any waiting notifications
- Continue responding to user or processing next queued item
Error Messages/Logs
## Timeline from Logs
23:24:51.214Z - Launched 8 async agents (Task tool)
23:26:30.119Z - Agent ad1b0ca completed → enqueued
23:26:40.916Z - Agent a6fe280 completed → enqueued
23:30:19.540Z - Agent a0fc8d5 completed → enqueued
23:34:02.877Z - Agent a3d011b completed → enqueued
23:34:14.892Z - Agent adb1fb4 completed → enqueued
23:35:42.987Z - Agent a204fb5 completed → enqueued
23:35:59.488Z - Agent a1c79ec completed → enqueued
23:36:54.661Z - Agent ac6fcc7 completed → enqueued
23:39:27.789Z - Main session: assistant message (stop_reason: null)
23:39:27.846Z - System: turn_duration logged (932243ms)
[NO ACTIVITY FOR 5 HOURS 31 MINUTES]
05:10:16.370Z - User pressed Escape → dequeue operation
05:10:16.489Z - Queue processing resumed normally
Steps to Reproduce
Steps to Reproduce
- Launch multiple async agents using the Task tool (8 agents in this case)
- Allow agents to complete and enqueue their completion notifications
- Main session processes some notifications and completes a turn
- Bug occurs: Main session stops processing queue despite pending items
- Claude Code displays "thinking" spinner indefinitely
- Pressing Escape twice resumes normal operation
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.17
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
VS Code integrated terminal
Additional Information
Log Evidence
Last assistant message before hang (line 355):
{
"type": "assistant",
"timestamp": "2026-02-10T23:39:27.789Z",
"message": {
"stop_reason": null,
"stop_sequence": null,
"usage": {
"output_tokens": 6
}
}
}
Turn duration logged (line 356):
{
"type": "system",
"subtype": "turn_duration",
"durationMs": 932243,
"timestamp": "2026-02-10T23:39:27.846Z"
}
First activity after hang (line 357):
{
"type": "queue-operation",
"operation": "dequeue",
"timestamp": "2026-02-11T05:10:16.370Z"
}
---
Hypothesis
The stop_reason: null suggests the response stream may not have properly terminated, leaving the client in an ambiguous state:
- Waiting for more streaming output that never arrives, OR
- Stuck between "turn complete" and "ready for queue processing"
The queue processor appears to be blocked or waiting on a condition that is never satisfied until user interruption.
---
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗