[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
Found 3 possible duplicate issues:
- https://github.com/anthropics/claude-code/issues/13488
- https://github.com/anthropics/claude-code/issues/12507
- https://github.com/anthropics/claude-code/issues/12084
This issue will be automatically closed as a duplicate in 3 days.
- If your issue is a duplicate, please close it and 👍 the existing issue instead
- To prevent auto-closure, add a comment or 👎 this comment
🤖 Generated with Claude Code
nope, bot, this is not the same as the 3 tickets you found (even though i actually suffered from that too, from v2.0.43 till the late fifties, i think, but then it went away). this bug manifests only after executing shell commands from within CC, not immediately upon container startup.
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.