[BUG] Bogus "ANSI-C quoting" in Bash permission prompt rationale
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?
This command line does not actually contain any ANSI-C quoting:
Bash command
ls /Users/(me)/git/(project)/logs/ | grep '^log-' | grep '\.json$' | tail -5; ls
/Users/(me)/git/(project)/logs/ | grep '^log-' | grep '\.json$' | wc -l
Count and sample log JSON files
Command contains ANSI-C quoting which can hide characters
Do you want to proceed?
❯ 1. Yes
2. No
Esc to cancel · Tab to amend
What Should Happen?
Ideally, Claude should not display a prompt for this command if it doesn't actually contain ANSI-C quoting. (Also, Claude should know how to do ls ./log-*.json instead of the stupid multiple grep filters!) Less ideally, do not display a rationale for the prompt which isn't true.
Error Messages/Logs
Steps to Reproduce
I am not sure whether this is reproducible. I managed to get the same prompt again by asking Claude to rerun this same command but I'm unclear on what exactly the criteria for that prompt are. My suspicion is that it looks for $' and doesn't realize that this doesn't apply when that's the _end_ of a single-quoted string. I do not get the prompt forecho 'foo$' or cat /etc/manpaths | grep '\.json$' | tail
Claude Model
Sonnet (default)
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
2.1.50 (Claude Code)
Platform
AWS Bedrock
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
This is quite similar to my earlier bug report https://github.com/anthropics/claude-code/issues/27899 but I'm filing it as a separate issue just in case.
This issue has 12 comments on GitHub. Read the full discussion on GitHub ↗