[Bug] Claude Code HTML-encodes bash operators in tool calls despite explicit instructions
Bug Description
Bug Report: AI Assistant HTML-Encodes Bash Commands Despite Explicit Instructions
Summary
Claude Code HTML-encodes bash command operators (e.g., && instead of &&) in tool
calls, causing parse errors, despite explicit user instructions prohibiting this behavior.
Reproduction
- Add this instruction to CLAUDE.md:
- ALWAYS construct bash commands directly as strings, never HTML-encode them
NEVER HTML ENCODE bash commands.
- Request a task requiring chained bash commands (e.g., "cd into directory and run
build")
- Observe the generated Bash tool call
Expected Behavior
<invoke name="Bash">
<parameter name="command">cd /path/to/project && xcodebuild build</parameter>
</invoke>
Actual Behavior
<invoke name="Bash">
<parameter name="command">cd /path/to/project && xcodebuild build</parameter>
</invoke>
Result
(eval):1: parse error near `&'
The shell receives literal && characters (HTML entity), not the bash && operator.
Impact
- Commands fail with parse errors
- Wastes execution attempts
- User must intervene and correct
- Violates explicitly stated user preferences in project documentation
Notes
This appears to be an XML/HTML escaping issue where the assistant over-applies entity
encoding to tool parameters that should contain literal command syntax.
Environment Info
- Platform: darwin
- Terminal: cursor
- Version: 2.0.33
- Feedback ID: ca577f95-2460-43ec-9c64-aa539f7a8480
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗