Bug Description
Tools edit, write, bash, and task consistently fail with JSON Parse error: Unterminated string when the parameter content contains:
- LaTeX math delimiters (
$, $$)
- Backslash sequences (
\tanh, \sum, \frac, \text)
- Pipes (
|)
- Mixed CJK + ASCII characters
- Content exceeding ~50 lines
The read tool works fine (parameters are simple paths + numbers with no special characters).
Reproduction
- Open any file containing LaTeX math (e.g., a markdown file with
$...$ formulas)
- Try to use the
edit tool to replace a section containing $, $$, \frac, etc.
- Tool call fails immediately with:
JSON Parse error: Unterminated string
Minimal reproduction — even this fails:
edit(file_path="/tmp/test.md", old_string="hello", new_string="world")
→ JSON Parse error: Unterminated string
Root Cause Analysis
Tool parameters are passed via XML invoke tags and internally serialized to JSON. The JSON serializer cannot properly escape special characters ($, ", \, \n) in string-type parameters, causing the string termination boundary to be misdetected.
- Works:
read tool (parameters are file paths + integers, no special chars)
- Fails:
edit, write, bash, task (parameters contain markdown/LaTeX content with $, \, ")
Environment
- MiMo Code version: 0.1.3
- Platform: linux (ARM64)
- Binary:
~/.mimocode/bin/mimo (ELF 64-bit LSB executable, ARM aarch64)
Workaround
Delegate file edits to subagents — subagents use a different parameter passing path that doesn't trigger this bug.
Impact
This bug makes it impossible to directly edit any file containing LaTeX math, markdown formulas, or mixed-language content. Every edit/write attempt consumes a full turn cycle with no visible output to the user, appearing as a terminal hang.
Related
- Observed across multiple sessions (confirmed in session checkpoints)
- Also affects
bash tool with any content
task tool with long prompts also fails
Bug Description
Tools
edit,write,bash, andtaskconsistently fail withJSON Parse error: Unterminated stringwhen the parameter content contains:$,$$)\tanh,\sum,\frac,\text)|)The
readtool works fine (parameters are simple paths + numbers with no special characters).Reproduction
$...$formulas)edittool to replace a section containing$,$$,\frac, etc.JSON Parse error: Unterminated stringMinimal reproduction — even this fails:
Root Cause Analysis
Tool parameters are passed via XML
invoketags and internally serialized to JSON. The JSON serializer cannot properly escape special characters ($,",\,\n) in string-type parameters, causing the string termination boundary to be misdetected.readtool (parameters are file paths + integers, no special chars)edit,write,bash,task(parameters contain markdown/LaTeX content with$,\,")Environment
~/.mimocode/bin/mimo(ELF 64-bit LSB executable, ARM aarch64)Workaround
Delegate file edits to subagents — subagents use a different parameter passing path that doesn't trigger this bug.
Impact
This bug makes it impossible to directly edit any file containing LaTeX math, markdown formulas, or mixed-language content. Every edit/write attempt consumes a full turn cycle with no visible output to the user, appearing as a terminal hang.
Related
bashtool with any contenttasktool with long prompts also fails