You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Tool calls fail with JSON Parse error when description ends with a dot #24177
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
Kimi k2.5 has issues with tool calling #20650: Kimi k2.5 tool calling fails with identical JSON Parse error: Unterminated string — the truncated JSON in the error even shows a dot before the cut-off, matching your hypothesis
Activity
github-actions commentedon Apr 24, 2026
This issue might be a duplicate of existing issues. Please check:
JSON Parse error: Unterminated stringerror on tool calls (different model, same symptom)JSON Parse error: Unterminated string— the truncated JSON in the error even shows a dot before the cut-off, matching your hypothesisfix(session): use jsonrepair lib for truncated tool call JSON
github-actions commentedon Jul 3, 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.