Repository navigation
Description
Description
I’m seeing OpenCode produce raw <tool_calls>, <tool_call>, <tool_sep>, <arg_key>, and <arg_value> markup inside reasoning text. Once that happens, the following tool call can fail with a JSON parse error.
# invalid [tool=bash, error=Invalid input for tool bash: JSON parsing failed: Text: {"command": "git diff 94db11c..f503075 --stat</arg_value>\n<arg_key>description</arg_key>:\n<arg_value>Show files changed in the diff range</arg_value>\n.
Error message: JSON Parse error: Unterminated string]
The arguments provided to the tool are invalid: Invalid input for tool bash: JSON parsing failed: Text: {"command": "git diff 94db11c..f503075 --stat</arg_value>\n<arg_key>description</arg_key>:\n<arg_value>Show files changed in the diff range</arg_value>\n.
Error message: JSON Parse error: Unterminated string
[JSON PARSE ERROR - IMMEDIATE ACTION REQUIRED]
You sent invalid JSON arguments. The system could not parse your tool call.
STOP and do this NOW:
1. LOOK at the error message above to see what was expected vs what you sent.
2. CORRECT your JSON syntax (missing braces, unescaped quotes, trailing commas, etc).
3. RETRY the tool call with valid JSON.
DO NOT repeat the exact same invalid call.
Click to collapse
# invalid [tool=bash, error=Invalid input for tool bash: JSON parsing failed: Text: {"command": "git diff 94db11c..f503075 -- src/contracts.ts</arg_value>\n<arg_key>description</arg_key>:\n<arg_value>Show contracts.ts changes</arg_value>.
Error message: JSON Parse error: Unterminated string]
The arguments provided to the tool are invalid: Invalid input for tool bash: JSON parsing failed: Text: {"command": "git diff 94db11c..f503075 -- src/contracts.ts</arg_value>\n<arg_key>description</arg_key>:\n<arg_value>Show contracts.ts changes</arg_value>.
Error message: JSON Parse error: Unterminated string
[JSON PARSE ERROR - IMMEDIATE ACTION REQUIRED]
You sent invalid JSON arguments. The system could not parse your tool call.
STOP and do this NOW:
1. LOOK at the error message above to see what was expected vs what you sent.
2. CORRECT your JSON syntax (missing braces, unescaped quotes, trailing commas, etc).
3. RETRY the tool call with valid JSON.
DO NOT repeat the exact same invalid call.
Click to collapse
Thinking: I see the issue - the JSON is being malformed. Let me fix the tool calls with proper JSON syntax. The issue seems to be with the newline characters in the description field. Let me simplify and fix the JSON
I checked the session database and this is not limited to one model. In the current scan it shows up with big-pickle, hy3-preview-free, and z-ai/glm-5.1. Big Pickle started failing tool calls notoriously last few days. If it is currently secretly HY3, then there might be something wrong with that model.
I don’t think this is coming from the local encoder or from my plugins. I did several scans of the opencode source code and pluginns source codes that I have - nothing shows up in there that links to these failed tool calls. The bad tags seem to be already in the session data before Opencode tries to execute the tool.
Plugins
qartez-guard
oh-my-openagent
@slkiser/opencode-quota
@tarquinen/opencode-dcp
caveman-opencode-plugin
opencode-kilo-auth
OpenCode version
1.14.33
Steps to reproduce
- Start Opencode on Windows with the
opencodeprovider. - Use
big-pickle,hy3-preview-free, orz-ai/glm-5.1. - Ask it to do something that leads into a shell/tool call.
- At some point the assistant returns
reasoningtext that already contains raw<tool_calls>markup, and the next tool call can fail withJSON Parse error: Unterminated string.
Screenshot and/or share link
Operating System
Windows 11
Terminal
Windows Terminal / PowerShell
Activity
github-actions commentedon May 3, 2026
This issue doesn't fully meet our contributing guidelines.
What needs to be fixed:
Please edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue might be a duplicate of existing issues. Please check:
<tool_call>XML appears in reasoning output — very similar symptom (raw tool call markup in reasoning/thinking breaks execution)If you believe this was flagged incorrectly, please let a maintainer know.
github-actions commentedon May 3, 2026
Thanks for updating the issue! It now includes all the required information — a clear description, steps to reproduce, and system details. The compliance flag has been removed.
github-actions commentedon Jul 4, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.