[BUG] Claude Code repeatedly executes the same bash command dozens or hundreds of times
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?
Claude Code repeatedly executes the same bash command dozens or hundreds of times, causing
command spam in the terminal. This happens across all projects and all Claude models,
regardless of project configuration.
What Should Happen?
Each command should execute once. If a command succeeds, it should not be retried. If it fails,
there should be a limited number of retries with clear error messages.
Error Messages/Logs
The same command is executed repeatedly (30-50+ times) in rapid succession, creating output
like this:
Bash(git add settings.py && git commit -m "Fix CORS for booster PATCH requests
Bash(git add settings.py && git commit -m "Fix CORS for booster PATCH requests
Bash(git add settings.py && git commit -m "Fix CORS for booster PATCH requests
● Bash(git add settings.py && git commit -m "Fix CORS for booster PATCH requests
● Bash(git add settings.py && git commit -m "Fix CORS for booster PATCH requests
● Bash(git add settings.py && git commit -m "Fix CORS for booster PATCH requests
[... repeats 40+ more times ...]
Steps to Reproduce
Unknown - it happens intermittently during normal Claude Code usage, particularly when Claude
is executing git commands or other bash operations.
Claude Model
Not sure / Multiple models
Is this a regression?
Yes, this worked in a previous version
Last Working Version
Last version
Claude Code Version
Claude Code v2.0.27
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
WSL (Windows Subsystem for Linux)
Additional Information
Environment
- OS: Linux (WSL2 on Windows)
- Claude Code Version: Claude Code v2.0.27
- Affected Models: All Claude models (Sonnet, Opus, etc.)
- Frequency: Happens regularly across different projects
What I've Checked
- ✅ No hooks configured: Checked ~/.claude/hooks/ and project .claude/hooks/ - neither
directory exists
- ✅ No automated commands in CLAUDE.md: Checked both global ~/.claude/CLAUDE.md and
project-specific CLAUDE.md files - they only contain documentation and guidelines, no automated
command execution
- ✅ No settings.json hooks: Checked ~/.config/claude-code/settings.json - no hooks configured
- ✅ Happens across all projects: Not specific to one codebase or configuration
Impact
- Severely disrupts workflow
- Makes terminal output unreadable
- May cause unintended side effects (e.g., attempting to commit the same changes multiple
times)
- Forces me to interrupt Claude Code or restart the session
Steps to Reproduce
Unknown - it happens intermittently during normal Claude Code usage, particularly when Claude
is executing git commands or other bash operations.
Additional Context
The repeated commands appear in the terminal UI as tool calls, suggesting this is happening at
the tool execution layer rather than at the bash/git level. The commands themselves may be
succeeding on the first try, but Claude Code continues to execute them anyway.
This issue has 8 comments on GitHub. Read the full discussion on GitHub ↗