Claude’s automatically triggered Bash tool runs extremely slowly on Linux (v2.0.22)
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?
In the Linux environment, Claude’s automatically triggered Bash tool executes commands very slowly.
This happens when Claude internally decides to run Bash (for example, to execute a short script or system command).
The commands themselves are lightweight and should complete instantly, but the tool stays in a “Running” state for a long time (sometimes tens of seconds) before finishing.
If I manually run the same commands (e.g., using ! in the Claude code environment or directly in the terminal), they complete immediately — so the slowdown seems specific to how Claude launches or manages the Bash tool process internally.
Environment:
Claude version: 2.0.22
OS: Linux
Issue type: Performance degradation in internal Bash tool execution
Steps to Reproduce:
Ask Claude to perform a task that triggers its internal Bash tool (e.g., code execution or shell-based operations).
Observe that the tool stays in “Running” state much longer than expected.
Expected Behavior:
Automatically triggered Bash commands should execute as quickly as manual shell commands.
Actual Behavior:
Claude’s internal Bash process runs extremely slowly, even for trivial commands.
Additional Notes:
Manual Bash execution (via !) is fast.
The delay seems to come from the way the Bash tool is spawned or handled in Linux environments.
What Should Happen?
Bash tool should execute commands quickly and return results immediately.
Error Messages/Logs
Steps to Reproduce
Ask Claude to perform a task that triggers its internal Bash tool (e.g., code execution or shell-based operations).
Observe that the tool stays in “Running” state much longer than expected.
Claude Model
Other
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.0.22
Platform
Other
Operating System
Ubuntu/Debian Linux
Terminal/Shell
Other
Additional Information
_No response_
37 Comments
Found 2 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
This issue is not a duplicate of #6656 or #10132.
In my case, the problem occurs when Claude automatically triggers its internal Bash tool in a Linux environment — not when running commands manually or inside VSCode.
I am running into this same issue on macos
v2.0.28I have the exact same problem on a Windows 11 PowerShell setup. Commands will stay in
Running...state for multiple minutes before being executed.Same here, whenever Claude decides to run a Bash command, it will be in "Running..." state for several minutes before asking me whether it is allowed to execute it / or execute it after I approved.
This is exactly what I'm seeing on MacOS (v2.0.51)
Same here on Windows (v2.0.55)
This makes Git Bash and re-run OS extremely slow.
Same here with 2.0.32 on MacOS.
Very frustrating to wait about 1 minute each time a bash command must be launched.
Same issue on Linux. It seems to have taken a long time waiting for permission approval
<img width="2252" height="366" alt="Image" src="https://github.com/user-attachments/assets/a283f81f-049c-47e8-9e07-ff2349b13ea9" />
I experienced the same issue and solved it by not starting
fishwithin my zsh profile@LetsGoBonkers
Can you provide more details on the specific environment or configuration where you observe this slowdown? Additionally, are you currently using the
fishshell, or is it set up in your shell profile? Understanding these details might help in diagnosing the issue more effectively.sure, i was running it using the
fishcommand in my.zprofilefile on macOS 26.2. I did not try usingfishas my default shell.starshipis still enabled in my shell profile. other than that, my configuration is pretty much the default.This might be caused by the same error in #17040
@LetsGoBonkers Try to use debug mode and see if there's any error that causes the retry till timeout
same here, after upgrading oh-my-zsh for zshrc on my Macbook Pro M4, no matter in iTerm2 or VScode terminal, the first serveral Bash runs smoothly, the later take years util timout and I approve each of them, and start another loop of slow running Bash commands, really cannot rely on these.
same issue for me on WSL zsh shell
Exactly the same issue here. Macbook Pro M2, iTerm2.
Claude was installed through
npm install -g @anthropic-ai/claude-code.Also tried to install via
curl -fsSL https://claude.ai/install.sh | bashafter uninstalling the first one, same issue.Seems to be related to Bedrock.
EDIT: the fix that worked for me:
I might be hitting the same thing in #19247 ; going to test the
export ANTHROPIC_SMALL_FAST_MODEL=us.anthropic.claude-haiku-4-5-20251015-v1:0fix next time I see it.Confirming that
export ANTHROPIC_SMALL_FAST_MODEL=us.anthropic.claude-haiku-4-5-20251015-v1:0doesn't fix it for me.With that set:
Also, frequency seems to be increasing (MacOS 15.4.1). Just got two instances of this in a row:
using
ANTHROPIC_LOG=debug, got the following where amkdirfroze for 2m before printing debug output. It seems like the request right afterwards didn't take long at all, suggesting that the problem is after themkdirgets fired but before the network request gets sent:@ant-kurt would love your help here, since it looks similar to #4049 but doesn't respond to the
ANTHROPIC_SMALL_FAST_MODELfix.Thought it might have something to do with having
Bash(mkdir *)allowed in my globalsettings.json, but confirmed that's not it by removing it.Right now
mkdir,ls, andgitcommands consistently take 2m to run.. very frustrating.EDIT: Seems that while stuck like this, pressing
Ctrl-Cdoesn't actually kill the hung task.I had the same issue and Claude helped me to diagnosed it. Here is the solution:
Root Cause:
Claude Code's Bash tool makes a pre-flight check using Haiku (or ANTHROPIC_SMALL_FAST_MODEL) before executing
commands. If your API key doesn't have access to this model, the request fails with 403 and retries until timeout
(~2-3 minutes), then finally runs the command.
Solution:
Add the small/fast model to your API key permissions:
For custom API endpoints (like internal enterprise deployments):
Add to ~/.claude/settings.json:
{
"env": {
"ANTHROPIC_SMALL_FAST_MODEL": "claude-sonnet-4-5"
}
}
Then restart Claude Code.
Verification:
Run ANTHROPIC_LOG=debug claude and check for 403 errors when Bash commands are triggered.
Confirming that @lionhylra 's fix doesn't resolve the issue for me:
export ANTHROPIC_DEFAULT_HAIKU_MODEL=claude-haiku-4-5-20251001doesn't change anythingls, in this case) is stuck:Possible thread to pull on: in my logs I see the following around shell snapshot code:
so at least 10 of the seconds are due to the same bug as https://github.com/anthropics/claude-code/issues/19585
I found a fix.
The problem is that Claude's shell snapshotting tool somehow ends up reading the .bashrc. Apparently, it didn't like mine.
I added this at the start of my .bashrc, and now Bash commands are working instantly again:
So if you run
claude --debugand seeShell snapshot creation failedin the logs, then try adding this.Also relevant: https://github.com/anthropics/claude-code/issues/3505
I'm using a corporate llmproxy. That implies adding the prefix "vertex_ai" for all the models including the SMALL_FAST one I didn't customize.
Adding this to my settings.json solved my problem:
"ANTHROPIC_SMALL_FAST_MODEL": "vertex_ai/claude-haiku-4-5"
No more frustrations when calling bash tool :-)
You are GOATED. I have been trying to fix this for so long. Stayed up until 4:30AM just now trying so many different solutions. You finally saved me. Owe you a trillion dollars
Haha thanks @edwarddjss ; glad it helped!
Thank you but I still got the very slow response from Bash in Claude CLI
<img width="267" height="95" alt="Image" src="https://github.com/user-attachments/assets/9beed8f0-4dca-4e38-9c05-557b491a1aa8" />
I think 3m is a very slow response
Same here on linux. This makes it impossible to use claude code.
For anyone who uses claude code with bedrock models, check if your IAM role has this policy
AWSMarketplaceManageSubscriptions, the error I got for the slowness isUnfortunately none of these fixed the issue and it's the same for me, many minutes waiting.
I also had the same situation, Windows 11, waiting a long time for a popup to see if it was allowed to run
I found Claude scans the pwd before each tool call. This can be painless if you have a small project beneath you, but painful when you've got multiple /**/node_modules and multiple work trees.
As a workaround, I'm creating an empty claude/ in my workspace, symlinking CLAUDE.md, and launching the TUI from there.
Had a similar issue related to the Bash() too, could be the same one, but I fixed it by writing an mcp that just proxies bash calls through node and have it run commands through that instead. Seems be a lot faster than waiting several minutes for anything to happen