[BUG] Pipe operator (|) in quoted strings incorrectly interpreted as shell pipe in Bash tool

Resolved 💬 8 comments Opened Jul 5, 2025 by orgoj Closed Jan 26, 2026

Environment

  • Platform (select one):
  • [x] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [ ] Other: <!-- specify -->
  • Claude CLI version: v1.0.43
  • Operating System: Linux (detected as Ubuntu-based from environment)
  • Terminal: vs code

## Bug Description
Pipe operator (|) in quoted strings is incorrectly interpreted as shell pipe operation in Bash tool calls,
causing commands to fail with generic "Error" instead of treating the pipe as a literal character within quotes.

## Steps to Reproduce

  1. Open Claude Code and use the Bash tool
  2. Execute any command with | inside quoted strings, for example:
  • rg -n "^import|^from" /path/to/file.py
  • grep -E "pattern1|pattern2" file.txt
  • sed "s/old1|old2/new/" file.txt
  1. Observe the command fails with generic "Error" message

## Expected Behavior
Pipe operator inside quoted strings should be treated as literal character (regex alternation, etc.), not as shell
pipe operator. The same commands work correctly when executed directly in shell.

## Actual Behavior

  • Commands fail with generic "Error" output
  • Using --trace with ripgrep reveals corrupted regex parsing with shell redirection artifacts (e.g., `<

/dev/null` appears in parsed regex)

  • No meaningful error message is provided

## Additional Context
This affects all commands expecting literal pipe characters in quoted arguments, including regex patterns with
alternation. Debug trace shows the issue is in quote parsing/shell interpretation within the Bash tool environment.
Workarounds include splitting into multiple commands or using internal tools (Grep, Glob, etc.) instead of
Bash+external tools.

View original on GitHub ↗

This issue has 8 comments on GitHub. Read the full discussion on GitHub ↗