[BUG] claude struggles with code containing `!`

Resolved 💬 2 comments Opened Apr 1, 2025 by max-sixty Closed Apr 2, 2025

Environment

  • Platform (select one):
  • [x] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [ ] Other: <!-- specify -->
  • Claude CLI version: 0.2.57 <!-- output of claude --version -->
  • Operating System: macOS <!-- e.g. macOS 14.3, Windows 11, Ubuntu 22.04 -->
  • Terminal: alacritty <!-- e.g. iTerm2, Terminal App -->

Bug Description

I frequently get these sorts of errors, where claude has put escapes before exclamation marks ! in code it's written out


     error: unknown start of token: \
      --> macro_test.rs:6:16
       |
     6 |         println\!("Stringified value: {}", stringify\!($value));
       |                ^

     error: unknown start of token: \
      --> macro_test.rs:6:53
       |
     6 |         println\!("Stringified value: {}", stringify\!($value));
       |                                                     ^

is there some intended escaping of !? would it be possible to try to help it work out when to use escapes?

View original on GitHub ↗

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