[BUG] Bogus "ANSI-C quoting" in Bash permission prompt rationale

Status Open
Reported on v2.1.50
Maintainer reply None cached
Activity 15 comments · opened Feb 24, 2026

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.

View original on GitHub ↗

13 Comments

github-actions[bot] · 6 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/16969
  2. https://github.com/anthropics/claude-code/issues/16946
  3. https://github.com/anthropics/claude-code/issues/27899

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

fsc-eriker · 6 months ago

None of these are even remotely related except the last one, which I already mentioned. It's a different part of the Bash syntax and a different warning message so I am keeping these separate.

danfuzz · 6 months ago

I'm running into this(ish) issue too. By way of suggestion, CC could use a library/tool like shfmt <https://github.com/mvdan/sh> to get a parse tree from the text and thereby be able to only flag commands that _actually_ contain ANSI-C strings with \x escapes (and not non-strings, or ANSI-C strings that don't have arguably-sneaky escapes).

fsc-eriker · 5 months ago

Adding a noise comment to avoid hav ing this closed.

fsc-eriker · 5 months ago

Adding another noise comment to prevent this from being closed.

fsc-eriker · 4 months ago

Adding a noise comment to prevent this from being closed.

fsc-eriker · 4 months ago

Adding a noise comment to prevent this from being closed.

fsc-eriker · 3 months ago

Adding a noise comment to prevent this from being closed.

fsc-eriker · 3 months ago

Adding a noise comment to prevent this from being closed.

fsc-eriker · 2 months ago

Adding a noise comment to prevent this from being closed.

fsc-eriker · 2 months ago

Adding a noise comment to prevent this from being closed.

fsc-eriker · 1 month ago

Adding a noise comment to prevent this from being closed.

fsc-eriker · 1 month ago

Adding a noise comment to prevent this from being closed.

Showing cached comments. Read the full discussion on GitHub ↗