[BUG] Frequent crashes when running agents requiring repeated --resume cycles (Sonnet 4.5)
[BUG] Frequent crashes when running agents requiring repeated --resume cycles (Sonnet 4.5)
Description
Claude Code crashes repeatedly during agent execution, requiring continuous use of --resume to make any progress. After resuming, the session runs for a few steps before crashing again, creating an endless crash-resume-crash cycle that makes agent-based workflows nearly unusable.
Environment
- Claude Code Version: 2.0.1
- Platform: Linux (Rocky Linux, kernel 5.14.0-570.37.1.el9_6.x86_64)
- Architecture: x86_64
- Model: claude-sonnet-4-5-20250929
- Agent Usage: Heavy use of custom agents via Task tool (tdd-engineer, code-reviewer, systems-architect-spec-writer, etc.)
- Agents Configured: 24 custom agents in
~/.claude/agents/
Symptoms
- Start Claude Code session with agent-based workflow
- Main context delegates to agent via Task tool
- Claude Code crashes - session terminates unexpectedly
- Use
claude --resumeto continue session - Session resumes, agent completes a few more steps
- Claude Code crashes again - another unexpected termination
- Use
claude --resumeagain - Cycle repeats indefinitely - crash → resume → few steps → crash → resume
Crash Pattern
Frequency: Multiple crashes per agent task
Predictability: Consistent - happens with most agent invocations
Timing: Unpredictable - can crash at any point during agent execution
Recovery: Only via --resume - normal error handling doesn't help
Impact
Severity: Critical - Agent workflows essentially broken
- Cannot complete agent tasks without 5-10 crash-resume cycles
- Productivity destroyed - simple tasks require constant intervention
- Context fragmentation - each resume loses some working context
- Session state uncertainty - unclear what completed vs what crashed mid-operation
- User exhaustion - babysitting crash-resume loops instead of productive work
Agent Execution Context
Custom Agent System:
- 24 specialized agents (tdd-engineer, code-reviewer, elite-code-reviewer, systems-architect-spec-writer, etc.)
- Agents recently updated to be self-contained with embedded standards
- Heavy use of Task tool for agent delegation
- Multi-step workflows involving agent → agent communication
Typical Crash Scenario:
- User: "Implement feature X using TDD"
- Main context: Task(tdd-engineer, ...)
- tdd-engineer: Starts implementation, writes tests
- CRASH - session terminates
claude --resume- tdd-engineer: Continues, implements code
- CRASH - session terminates again
claude --resume- tdd-engineer: Runs tests
- CRASH - yet another termination
- ... repeat until task eventually completes
Related Issues - Crash Epidemic (Oct 2-3, 2025)
This appears to be part of a systemic agent stability crisis with Sonnet 4.5:
Identical Timeframe - All Oct 2-3, 2025:
- #8706 - "Resource Exhaustion and Crashes with Claude Sonnet 4.5 in Agents" (100% crash rate)
- #8883 - "TDD Orchestrator crashes with heap out of memory"
- #8829 - "VSCode crashes when running parallel agents and subagents"
- #8737 - "Memory Leak Causing Mac System Crash During Extended Sub-Agent Sessions"
- #8722 - "VS Code crashes with OOM error: 700MB+ conversation history"
Common Patterns Across All Reports:
- ✅ Agent execution triggers crashes
- ✅ Sonnet 4.5 specific (Opus works fine per #8706)
- ✅ Memory exhaustion / heap out of memory
- ✅ Reported this week (Oct 2-3, 2025)
- ✅ Multiple platforms affected (Linux, Windows, macOS)
- ✅ No resolution available yet
Regression Information
Timeline:
- Prior Sonnet versions (3.5, 4.0): Agents worked reliably
- Sonnet 4.5 (sonnet-4-5-20250929 released Sept 29): Immediate widespread agent crashes
Evidence:
- Issue #8548 (Sept 30): User reports "Sonnet 4 did not have this issue last night"
- Issue #8706 (Oct 2): "Does not occur with Opus model in the same setup"
- Multiple reports within 48 hours of Sonnet 4.5 release
Conclusion: This is a confirmed Sonnet 4.5 regression affecting agent stability.
Expected Behavior
When running agent-based workflows:
- Agent should execute task without crashing
- If resource issues occur, should fail gracefully with error message
- Should not require multiple --resume cycles to complete simple tasks
- Memory usage should remain bounded during agent execution
- Session should remain stable throughout multi-agent workflows
Actual Behavior
- Unpredictable crashes during agent execution
- No error messages before crash (silent failure)
- Requires constant user intervention with --resume
- Tasks that should take minutes require hours of crash recovery
- Session state becomes fragmented across multiple resume cycles
Potential Root Causes (Based on Related Issues)
- Memory Leaks in Agent Context Management (#8737, #8722)
- Conversation history accumulates unbounded
- Agent context not properly garbage collected
- Each agent invocation adds to memory without cleanup
- Resource Exhaustion with Sonnet 4.5 (#8706)
- Sonnet 4.5 agents consume excessive disk I/O and memory
- Model-specific issue (Opus doesn't have problem)
- 100% reproducible with agent tasks
- Heap Allocation Failures (#8883)
- JavaScript heap out of memory during TDD/agent orchestration
- GC allocation failures under agent load
- 4GB+ memory consumption before crash
- Parallel Agent Instability (#8829)
- VSCode crashes when running parallel agents
- Sub-agent delegation compounds the issue
Attempted Workarounds
Tried:
- Using --resume after each crash (works but endless cycle)
- Reducing agent complexity (doesn't prevent crashes)
- Clearing cache/state between sessions (no effect)
Not Yet Tried (Based on Community Reports):
- Switch to Opus model (per #8706 - would solve but defeats purpose of using Sonnet 4.5)
- Manually cleaning conversation history before agent sessions
- Reducing number of parallel agent invocations
System Resource Observations
During Normal Agent Execution:
- Memory: [Would need to monitor during next crash]
- Disk I/O: [Would need to monitor during next crash]
- CPU: [Would need to monitor during next crash]
Note: Crashes occur before monitoring tools can capture peak resource usage - need instrumentation in place before next session.
Request for Fix
Priority: Critical - Sonnet 4.5 with agents is effectively unusable
Needed:
- Memory leak fix for agent context management
- Bounded resource usage during agent execution
- Graceful degradation instead of crashes
- Proper cleanup of agent contexts after task completion
- Error messages before crash (not silent failures)
Additional Context
This issue makes advanced Claude Code workflows (TDD orchestration, multi-agent collaboration, epic implementation) completely impractical with Sonnet 4.5. Users are forced to either:
- Use Opus (slower, more expensive) to avoid crashes
- Suffer through endless crash-resume cycles
- Abandon agent-based workflows entirely
Given that 5 similar issues were filed within 48 hours of Sonnet 4.5 release, this appears to be a critical regression affecting the agent system's core stability.
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗