Description
When the model emits a tool call (e.g., bash) where the description field ends with a dot (.), OpenCode's text extractor truncates the JSON immediately after that dot. The closing " and } are lost, causing JSON Parse error: Unterminated string or JSON Parse error: Expected '}'
Hypothesis: the pre-parser/regex that extracts JSON tool blocks from the model's raw text splits on sentence boundaries when it sees a dot inside the string value, cutting the JSON mid-object.
Workaround: just force to omit the trailing period in tool description fields. I created a skill for this and it kinda work, except when the model forget the skill.
Environment:
- Model: Kimi 2.6 (via LiteLLM proxy, API OpenAI-compatible)
- OpenCode version: 1.14.23 (from homebrew)
- LiteLLM backend logs: looks clean, the malformed JSON seems generated client-side during text extraction
Plugins
No response
OpenCode version
1.14.23
Steps to reproduce
Just prompt something like "run some bash commands to test" in a fresh opencode session.
An example:
Thinking: The user wants me to run some bash commands to test the system. I should run a few basic commands to test the bash tool functionality. Let me run some simple, non-destructive commands to demonstrate the tool
⚙ invalid [tool=bash, error=Invalid input for tool bash: JSON parsing failed: Text: {"command": "echo \"Hello World\"", "description": "Test basic echo.
Error message: JSON Parse error: Unterminated string]
⚙ invalid [tool=bash, error=Invalid input for tool bash: JSON parsing failed: Text: {"command": "pwd", "description": "Test current directory command.
Error message: JSON Parse error: Unterminated string]
With the skill:
# Show current directory
$ pwd
/Users/nmaillet/Desktop/tmppp
# Display current date
$ date
ven. 24 avr. 2026 16:56:12 CEST
Screenshot and/or share link
No response
Operating System
MacOS26.4.1
Terminal
No response
Description
When the model emits a tool call (e.g., bash) where the description field ends with a dot (.), OpenCode's text extractor truncates the JSON immediately after that dot. The closing " and } are lost, causing
JSON Parse error: Unterminated stringorJSON Parse error: Expected '}'Hypothesis: the pre-parser/regex that extracts JSON tool blocks from the model's raw text splits on sentence boundaries when it sees a dot inside the string value, cutting the JSON mid-object.
Workaround: just force to omit the trailing period in tool description fields. I created a skill for this and it kinda work, except when the model forget the skill.
Environment:
Plugins
No response
OpenCode version
1.14.23
Steps to reproduce
Just prompt something like "run some bash commands to test" in a fresh opencode session.
An example:
With the skill:
Screenshot and/or share link
No response
Operating System
MacOS26.4.1
Terminal
No response