[BUG] Bash tool hangs indefinitely with pipe characters in commands
Resolved 💬 3 comments Opened Jul 4, 2025 by paulscan Closed Sep 12, 2025
Environment
- Platform (select one):
- [ ] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [x] Other: Claude Code
- Claude CLI version: 1.0.43 (Claude Code)
- Operating System: macOS 15.5
- Terminal: PyCharm Terminal / Terminal.app
Bug Description
The Bash tool hangs indefinitely when using pipe characters (|) in commands, causing timeouts for common search and processing workflows. This affects any command that uses pipes, including simple operations like rg "pattern" | wc -l.
Steps to Reproduce
- Launch Claude Code in terminal
- Ask Claude to run:
rg "utcnow" --type py | wc -l - Observe that the command hangs and eventually times out after 2 minutes
- Run the same command directly in terminal - it executes instantly
Expected Behavior
The command should complete quickly and return the count of matching lines (e.g., 82).
Actual Behavior
The command hangs indefinitely and times out with "Command timed out after 2m 0.0s". The Bash tool appears to incorrectly parse the pipe character, preventing proper command execution.
Additional Context
- This affects any command with pipes, not just ripgrep (e.g.,
grep | wc -l,cat | head, etc.) - Commands without pipes work perfectly (
rg "pattern" --type py) - The same commands execute instantly when run directly by the user
- Workarounds include using
rg --count-matchesor avoiding pipes entirely - Related to issue #2859 but with complete reproduction steps and common use case
- Affects both PyCharm Terminal and Terminal.app equally
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗