[BUG] Long-running background bash tasks cause 'Aborted()' cascade and terminal crash
Description
When running a long-running background bash task (e.g., a build-sign-upload script that takes ~18 minutes), Claude Code enters a "Nesting..." state and then produces multiple Aborted() messages, completely crashing the terminal session. The user has to Ctrl+C to kill Claude Code and relaunch it.
This has happened repeatedly across multiple sessions — not a one-off occurrence.
Environment
- Claude Code version: 2.1.37
- Platform: macOS (Darwin 25.2.0, Apple Silicon ARM64)
- Shell: Terminal.app
Steps to Reproduce
- Start a long-running bash command in background mode, e.g.:
```
bash scripts/build-sign-upload.sh 2>&1
npm run build:mas`, code signing, packaging, and upload — takes ~15-20 minutes)
(This script runs
- Wait for the task to run in the background (~18 minutes)
- Claude Code shows:
```
- Nesting... (17m 55s · ↓ 132 tokens)
```
- Then the terminal fills with:
````
Aborted()
Aborted()
Aborted()
Aborted()
Aborted()
- Claude Code becomes unresponsive. Must Ctrl+C to exit.
Screenshot
The user provided a screenshot showing the exact sequence:
- Background bash task started with 10m timeout
- "Nesting..." indicator at 17m 55s
- Five consecutive
Aborted()messages - CLI becomes unusable
Impact
This is extremely frustrating for developers who rely on Claude Code for iterative build-test cycles. In this user's workflow (building macOS MAS apps with Electron), the build-sign-upload cycle takes 15-20 minutes and must be run frequently. Every crash means:
- Losing conversation context
- Having to relaunch Claude Code
- Re-explaining the current state of work
- Wasted time and broken flow
This has happened 5+ times in a single day for this user, making the tool nearly unusable for this workflow.
Expected Behavior
Background tasks should complete (or timeout gracefully) without crashing the CLI. If the task exceeds the timeout, it should report the timeout cleanly and remain interactive.
Possibly Related Issues
- #18390 (Background tasks that crash/fail still show as 'running')
- #17471 (CLI crashes without error message)
- #16135 (Background process termination crashes Claude Code)
Workaround
None reliable. The user has tried:
- Running the script in background mode (still crashes)
- Shorter timeouts (the build genuinely takes 15-20 min)
- Restarting Claude Code after each crash (tedious but necessary)
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗