[Bug] Claude Code HTML-encodes bash operators in tool calls despite explicit instructions

Resolved 💬 3 comments Opened Nov 4, 2025 by Plightt Closed Jan 9, 2026

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

  1. Add this instruction to CLAUDE.md:
  • ALWAYS construct bash commands directly as strings, never HTML-encode them

NEVER HTML ENCODE bash commands.

  1. Request a task requiring chained bash commands (e.g., "cd into directory and run

build")

  1. 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 &amp;&amp; xcodebuild build</parameter>
</invoke>

Result

(eval):1: parse error near `&'

The shell receives literal &amp;&amp; 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

View original on GitHub ↗

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