[BUG] Exclamation mark is escaped
Status Closed — not planned
Maintainer reply None cached
Workaround ✓ Mentioned in thread ↓
Activity 10 comments · opened Jul 3, 2025 · closed Jan 26, 2026
Environment
- Platform (select one):
- [x] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [ ] Other: <!-- specify -->
- Claude CLI version: 1.0.41 (Claude Code)
- Operating System: Debian 13
- Terminal: foot
Bug Description
I often observe claude executing a benign command with exclamation mark somewhere in the middle only to raise Error: ERROR: syntax error at or near "\"
Steps to Reproduce
- Work with SQL for some time
- Observe the error
Expected Behavior
Command is executed as-shown.
Actual Behavior
Error: ERROR: syntax error at or near "\"
LINE 1: ...1 END) as no_size_data FROM document WHERE status \!= 'delet...
Additional Context
Command shown after Bash(... had no backslash before the exclamation mark.
10 Comments
Same issue here as well. The exclamation mark escaping break every CLI that use this character. I has this problem when Claude execute HTTPie to a Graphql Endpoint:
The
!after CreateUserInput will be escaped as\\!which break the graphql syntax :( Tested on MacOS with kitty term.I don't think this issue is related to any terminal environment.
Can confirm I just ran into this when instructing a Claude Code sub-agent to execute the following command that relies on
jqfor filtering GItHub CLI/API responses:This results in the following error upon attempting execution:
I was able to work around this by changing to use
.name == "config.yml" | notbut I can imagine many other commands such as the ones above do not have that kind of flexibility.I dare you to count the number of failed Bash commands due to this bug, and sum up all the tokens wasted.
Workaround: tell Claude to use a "$(cat <<EOF)" heredoc:
Note, apparently claude-code pretty prints heredocs as quoted strings:
The journal reveals the successful tool call is actually:
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
Yes, this is still, embarrassingly, still happening.
This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.
This issue was closed incorrectly despite recent human comments. This behavior of the bot is reported at https://github.com/anthropics/claude-code/issues/16497. Please upvote that issue, so maybe it gets noticed.
this bug is absurd. And closed?
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.