Bash command timeouts due to shell hangs
Resolved 💬 36 comments Opened Feb 24, 2025 by ekvanox Closed Mar 5, 2025
💡 Likely answer: A maintainer (bcherny, collaborator)
responded on this thread — see the highlighted reply below.
Bug Description
Bash commands always timeout with code 143. I use MacOS with fish, tmux, & alacritty. I get the same problem in the default MacOS terminal with bash (without tmux).
Environment Info
- Platform: macos
- Terminal: tmux
- Version: 0.2.9
- Feedback ID: 66dc2745-228b-47a3-a286-30ea14afc296
Example:
> Can you merge in the dev branch? Make sure it is up to date with the remote first. Make resonable choices about what to get, and make sure not to remove functionality, but to instead combine it with the changes on the current branch.
⏺ I'll merge the dev branch into our current branch, making sure to get the latest remote changes. Let me handle this for you.
⏺ Bash(git branch -a)…
⎿ Command execution timed out
Exit code 143
⏺ Bash(git branch -a)…
⎿ Command execution timed out
Exit code 143
⏺ Let me try using a different approach to get branch information.
⏺ Bash(git fetch && git branch)…
⎿ Command execution timed out
Exit code 143
⏺ I'm having trouble with the git commands timing out. Let me try with a more focused approach:
⏺ Bash(git fetch origin dev && git merge origin/dev)…
⎿ Command execution timed out
Exit code 143
⏺ Let me try breaking this down into smaller steps with shorter timeouts:
⏺ Bash(git fetch origin)…
⎿ Command execution timed out
Exit code 143
⏺ It seems there might be network or repository issues causing timeouts. Let me try a different approach:
⏺ Bash(git remote -v)…
⎿ Command execution timed out
Exit code 143
⏺ I'm experiencing timeouts with git commands. This could be due to network issues or repository configuration. Let me try one more approach:
⏺ Bash(git status)…
⎿ Command execution timed out
Exit code 143
36 Comments
Getting the same problem. Wonder if it's something to do with fish?
same thing here. fish and ghostty. but I dropped into a bash shell in Terminal.app and experienced the same thing
I also tried using zsh as login shell,
env -i HOME=$HOME PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin zsh -land then running Claude direct from the binary path, met with same issue .sshed into a linux server that has fish and bash, dropped into bash, same issue (half the time it crashes instead).
seemed plausible to me (had similar problems when using sgpt when using fish) but i'm getting the same issue from bash too
note that
sudo claudeseems to help with this, at the cost of messing up other operations (commits get created as root for one, and then ssh-agent . I'm also using mise for node+npm, but it persisted when using fnm as well. persists when I dosudo -u $USER claude.also using mise here
thanks, can confirm this allows claude to run commands (but introduces other problems caused by
sudousage)also used mise! uninstalled, problem seems to have persisted.
I swapped to the homebrew version of zsh, w/ mise and oh-my-posh still, ran claude, !ls works consistently now (where it wasn't before even running any bash command without running it through Sonnet).
docs say fish isn't supported but zsh is, but doesn't explain the behavior reported before. I did ensure I was using mise and installed via
mise use -g npm:@anthropic-ai/claude-code.with ghostty, I also had to COMPLETELY close ghostty, not just open a new terminal tab, before my shell would actually switch.
ok, I think i've solved it. it's the
$SHELLenv var.I ran this in fish:
and commands ran fine
Same issue here (fwiw I use zsh and mise), but @bobisme's comment above seems to work for me.
Encountering the same issue and @bobisme var setting solved it. Thank you for sharing!
for me, the shell setting didnt help, but sudo did (even while still using
fish).I'm running zsh (ala brew), and can confirm that running
works, per @bobisme 's comment above. Thanks all!
Edit: P.S. This might suggest that
claudeisn't resolving default shell from env var. I can't check now, but will try later this week!I had shell set to a path in my nix store (
/nix/store/2hq38y4h3793c1x686z2vv4fvjmp4wc1-fish-3.7.1/bin/fish) which also triggered the issue.If you use claude-code from nixpkgs-master, as a short fix, you can just override the SHELL for the claude binary.
I presume this is a really short lasting issue, but maybe someone can profit from my fix.
Edit: To clarify, no need to use sudo (not sure if this ever would be a good idea to give claude sudo rights), and also you probably have to make sure you have
bashin your path).This should be feeling better on 0.2.18. Restart to update.
We landed a fix for fish shell with 0.2.18 so hopefully you 🐟 users should be happier. However, the shell can hang for a variety of reasons. We will continue to track these down with your help. Please make sure you are using one of our supported shells: bash, zsh or fish.
Thanks! I updated, but it's still hanging in fish :(
!Image
same behavior on fish! (macos)
SHELL=/opt/homebrew/bin/bash claudedoes not fix unfortunately.sudo works.
0.2.18
For the record, fish user on linux
SHELL=/bin/bash claude- fixed this issue for meI wonder what the commonality is for the people where it didn't work.
Ok, I'll continue to add logging. Right now, we try to spawn a login shell because I am lazy. I can implement the startup sequence in the app. I'll test this a little bit and report back.
The other issue could be locating a shell executable. I added logging for that.
Also fish user here, and
SHELL=/bin/bashfixed it.However, for some reason, I never managed to get
claudecommand in my path, so I ended with a fish function:It could always be a config option for the user to supply the path, or you could have claude code find it for them 😁
I'm curious if the tool is trying to use bash, specifically, or it's trying to use the user's shell. I see the tool is called BashTool internally, so I assumed it was just bash. I would be fine with that even though I use fish as my interactive shell.
Of course, if the source were open, we could help debug 😉.
BashTool is a misnomer. It should be called ShellTool. We support bash, zsh, and fish and try to choose the right one.
Is Fish shell officially supported? On your website you still have the information that Fish is not supported.
!Image
I'm in Mac with Fish and I have this issue
Using Claude 0.2.29 under Fish 4.0.0 I'm seeing problems with spaces in paths. I'm not sure if this problem is related to this Issue, but I'd rather not burn more tokens investigating. If there's a way for me to get additional debugging information, please let me know.
I'm running from inside a path like "/Volumes/MyDrive/Source/Foo Bar", and there's also a "/Volumes/MyDrive/Source/Foo" directory.
When I run
claudeunder fish with no SHELL environment override, and I simply command it to "commit", I get a timeout.When I run
env SHELL=/bin/bash claudeand command it to "commit", it seems to ignore spaces in the path. I used claude-code to make changes to several files in "/Volumes/MyDrive/Source/Foo Bar", but when I tell it "commit" it outputs:(Under an earlier version of claude-code, it made and committed a bunch of changes in "/Volumes/MyDrive/Source/Foo", but I don't remember all the details.)
Whitespace in filenames (or obviously their paths) is the repeatable culprit for me here. Factory zsh with and without oh-my-zsh enhancements. No amount of SHELL or PATH finagling made any difference.
find . -type f -name "* *" | while read file; do mv "$file" ${file// /_}; doneis your friend to reel you back from the comforting embrace of OS X and slap you with a dose of common sense.I do not have any spaces in the path I'm running in (under Fish 4, on MacOS). In fact I can reproduce this in /tmp/foo.
@wolffiex did you mean to close this as a duplicate of #208? That reads like a different issue
sorry, my fault. this is still live but we have some updates coming. we are testing a fix where claude always gets a POSIX shell even if the user's shell is set to something different. we will let it bake for a bit then roll it out.
Hi everyone, thanks for your patience with this. We just pushed v0.2.32 which hopefully will fix most of the issues here. The details:
~/.[z|b]shrcwe try to source that so you and claude can share aliases and env varsWe try to find a shell a few ways:
which [b|z]shYou shouldn't need to do this anymore:
If you update and things are still broken, please let us know!
closing, please start over additional feature requests or new bug reports
Thank you so much! It has also helped, since i was using
zshell.I had a problem with
claude coderunning bash commands. It seemed to freeze. It couldn't run any of bash commands and time-outs after 2 minutes. But it still could write its own tools – create files, editing them. And all Bash(...) calls seemed to failTurned out it was because i was using it in zshell.
exec /usr/bin/zshin~/.bashrc.bash --login,echo $0- should printbashclaudehere. And all commands starts executing!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.