[BUG] Shell parser crash on Math.round - Bad substitution error
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Claude Code crashes with a shell parsing error when encountering Math.round in JavaScript code. The crash occurs in the shell command
parsing logic with the error: Error: Bad substitution: Math.round.
## Stack Trace
Error: Bad substitution: Math.round
at D (file:///home/robertspeer/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:80:79195)
at file:///home/robertspeer/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:80:79854
at Array.map ()
at eZ9 (file:///home/robertspeer/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:80:78933)
at Object.A (file:///home/robertspeer/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:80:80018)
at _j6 (file:///home/robertspeer/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1757:29074)
at fj6 (file:///home/robertspeer/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1757:32565)
at file:///home/robertspeer/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1757:33114
at Array.every ()
at Q0B (file:///home/robertspeer/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1757:33052)
## Environment
- Platform: Linux 6.12.10-76061203-generic
- Working Directory: /home/robertspeer/Projects/GitRepo/nearest-nice-weather
- Project Type: Node.js/JavaScript project
## Root Cause Analysis
The shell command parser incorrectly interprets Math.round as a variable substitution pattern (like ${variable}) instead of treating it
as literal JavaScript code. The parser fails when trying to process this as a shell variable substitution.
## Reproduction
This appears to occur when:
- Working with JavaScript code containing
Math.round - Claude Code attempts to parse or validate shell commands
- The
Math.roundtext gets passed through the shell parser incorrectly
## Expected Behavior
Math.round in JavaScript code should not be interpreted as shell variable substitution syntax.
## Actual Behavior
Claude Code crashes with "Bad substitution" error and becomes unresponsive.
## Suggested Fix
The shell parser should properly escape or handle JavaScript expressions to avoid misinterpreting them as shell syntax.
---
Personal Note: @Boris @Cat - Thank you both for your excellent work on Claude Code! Really appreciate all the effort you put into making
this tool amazing. 🙏
I was unable to recreate the issue.
What Should Happen?
not crashing and kicking me out of Claude Code
Error Messages/Logs
Error: Bad substitution: Math.round
at D (file:///home/robertspeer/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:80:79195)
at file:///home/robertspeer/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:80:79854
at Array.map (<anonymous>)
at eZ9 (file:///home/robertspeer/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:80:78933)
at Object.A (file:///home/robertspeer/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:80:80018)
at _j6 (file:///home/robertspeer/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1757:29074)
at fj6 (file:///home/robertspeer/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1757:32565)
at file:///home/robertspeer/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1757:33114
at Array.every (<anonymous>)
at Q0B (file:///home/robertspeer/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1757:33052)
Steps to Reproduce
I was unable to reproduce
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
v1.0.110
Platform
Anthropic API
Operating System
Other Linux
Terminal/Shell
Other
Additional Information
happened working on this repository:
https://github.com/PrairieAster-Ai/nearest-nice-weather
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗