claude-code - 💡(How to fix) Fix [BUG] If a user types a \ in the prompt, in certain cases, it's treated as an escape character, for example ~\.folder [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#48103Fetched 2026-04-15 06:33:07
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Author
Timeline (top)
labeled ×3commented ×1

Error Message

Error Messages/Logs

RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

User prompts should be read as the user types them. If the users text needs to be pre-processed to escape characters that should be done by the input handler. When I type a path or some other sequence of text with backslashes, For example: ~.claude, it shouldn't turn into ~.claude. If the internal mechanism needs a \ escaped, it should escape it. The user shouldn't have to type ~\.claude ever to represent a single .

What Should Happen?

A user should type ~.claude and see ~.claude when it posts, not ~.claude. If the input handler escapes it for internal use, it should un-escape it for re-displaying it.

Error Messages/Logs

Steps to Reproduce

Type text in a prompt for Claude... use \ within that text. It's context sensative so if the \ is followed by a . you just get a . instead of . as you should.

Claude Model

Sonnet (default)

Is this a regression?

Yes, this worked in a previous version

Last Working Version

I don't know what the previous version was, it updates on an almost daily basis.

Claude Code Version

Claude 1.2278.0 (e5213f) 2026-04-13T17:49:21.000Z

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Other

Additional Information

I couldn't see Claude for Windows as an option in choosing the Terminal I'm using.

extent analysis

TL;DR

The issue can be fixed by modifying the input handler to properly escape and unescape backslashes in user prompts.

Guidance

  • The input handler should be updated to escape backslashes only when necessary for internal processing, and then unescape them when displaying the user's input.
  • Verify that the input handler is correctly handling backslashes by testing with different input sequences, such as ~\.claude and ~\\\.claude.
  • Check the documentation for the Anthropic API to see if there are any specific requirements or guidelines for handling backslashes in user input.
  • Consider adding a feature to display the escaped input internally, to help with debugging and testing.

Example

No code example is provided as the issue does not include specific code details.

Notes

The fix may require changes to the input handler's logic for escaping and unescaping backslashes, and may involve additional testing to ensure that the fix works correctly in all scenarios.

Recommendation

Apply workaround: The issue is likely due to a change in the input handler's behavior, and a workaround can be applied by modifying the input handler to correctly handle backslashes.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [BUG] If a user types a \ in the prompt, in certain cases, it's treated as an escape character, for example ~\.folder [1 comments, 2 participants]