← 2.1.10 Primitive tested · runtime-test

Heredoc Fix

Bash commands containing heredocs with JavaScript template literal syntax like ${index + 1}.

Heredoc Fix is a runtime stability patch in Claude Code 2.1.10 that eliminates a crash when bash commands contain here-documents with JavaScript template literal syntax like ${index + 1}.

How It Works

The bug occurred during command parsing when Claude Code encountered template literal expressions nested inside heredocs. The parser mistakenly interpreted ${...} syntax as shell variable expansion rather than literal JavaScript code. In 2.1.10, parsing logic now respects the heredoc delimiter type: single-quoted delimiters like 'EOF' properly suppress all interpolation, allowing template literals to pass through as raw text.

What the Test Found

Runtime tests on 2026-01-16 verified the fix against two expressions:

  • ${index + 1} within a map callback compiled without crash
  • ${a + b + c} arithmetic expressions executed normally

Both cases used single-quoted delimiters (cat << 'EOF') to prevent shell interpolation. Execution proceeded without errors or stability issues.

Why It Matters

This fix restores heredoc compatibility for JavaScript and other languages that use ${} syntax. Tool systems and language servers that embed multi-language code snippets inside bash commands can now reliably use heredocs without defensive quoting workarounds or code fragmentation.

Caveats

The fix applies only to properly quoted delimiters; unquoted or double-quoted delimiters still perform shell variable expansion as expected. The patch is classified as a regression fix, not a feature addition, indicating the behavior should have shipped working in earlier versions.

Evidence & receipt
  • file2.1.10/tests/02-heredoc-fix/TEST-RESULTS.md
◇ ed25519 receipt
idprimitive_5c6b2ce45f0c78d097c01a3e
alged25519
pubkey9b87705613b1e2fd064d57fa75a6b679d2856ceafad6b1daa8f982493871b6dd
sigf5f3d431bdcd4de95e80b00ab6a2e6235e7775b9962d53e7edaf5d63cc2377ab3d3a69a841a0cee1552ec13e19e558e919a288a844eccd21d70639e461fe9208

Signed with an ed25519 key held off the repo. Anyone can verify against the published public key; nobody without the secret key can forge it. Click verify: it recomputes the signature in your browser. The signature proves integrity and authorship of this exact content — not a third-party timestamp or that the underlying claim is objectively true. signedAt is when the @f3/attest pipeline ran, not when the work happened; the evidence refs carry the source dates.

Connected