[BUG] CC running in container exits after 1st or 3rd shell command (!)
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?
as of v2.0.65, Claude Code "native" binary running in a Docker container/devcontainer on Linux exits after exactly the 3rd shell command (! <whatever>) completes and exits (crashes, i presume?) - at least with bash in Debian based containers. it doesn't matter which commands one invokes, CC exits even after true/false/ sleep 10 complete. e.g.:
$ time claude
▐▛███▜▌ Claude Code v2.0.65
▝▜█████▛▘ Haiku 4.5 · Claude Team
▘▘ ▝▝ /work/claude-code
! true
⎿ (No content)
! true
⎿ (No content)
! true
⎿ (No content)
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
>
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
v2.0.65 | claude-haiku-4-5-20251001 | 6k : 1k / 200k (3%) | /work/claude-code Thinking on (tab to toggle)
0 tokens
real 0m18.199s
user 0m0.059s
sys 0m0.043s
$
this is a regression:
- v2.0.42 - 2.0.54 - it was possible to invoke multiple commands without CC crashing in this range of versions. haven't tried reproing with earlier versions now, but i don't recall such nonsense.
- v2.0.55 - v2.0.59 - usually exits after the _very 1st shell_ command (e.g.
! true). if you switch model model first - sometimes it survives until the 3rd command and then exits. - v2.0.60 - v2.0.65 (at least) - let you execute exactly 3 shell commands, will wait until the 3rd one completes (even if it takes time) and then will exit.
there are no hooks configured in the system, no MCPs, no agents, no skills, no custom /commands, nada. happens equally with and without statusline command. happens with empty $HOME/.bashrc/$HOME/.profile. happens with any model. the bug is 100% reproducible in the relevant version ranges (see above). the contents of $HOME/.claude/debug/<UUID>.txt are very pedestrian, no errors, don't always end on the same thing.
no idea if this happens with npm-installed CC or outside Docker containers, and can't easily try that out (IT constraints).
this bug is a significant impediment to recent CC versions usage.
What Should Happen?
Claude Code should continue working even if the user executes multiple ! shell commands, not crash taking the entire context down.
Error Messages/Logs
nada! the "native" binary silently exits, no errors in ~/.claude/debug.
Steps to Reproduce
- start latest "native" Claude Code in a Docker container on Linux (e.g. custom devcontainer).
- issue 3 shell commands, e.g.
! false,! pwd,! true. - observe CC exiting back to shell (presumably crashing?).
Claude Model
Not sure / Multiple models
Is this a regression?
Yes, this worked in a previous version
Last Working Version
v2.0.54
Claude Code Version
2.0.65 (Claude Code)
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
Other
Additional Information
_No response_
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗