-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Description
Description
When using z-ai/glm5 via the NVIDIA NIM provider in OpenCode 1.2.6, tool calls intermittently emit malformed JSON arguments.
This causes repeated tool failures and retry loops with errors like:
Invalid input for tool tavily_tavily_search: JSON parsing failed: Text: {\"query\":\"Geoffrey Huntley LinkedIn Ralph Wiggum most viral reposts\".
Error message: JSON Parse error: Expected '}'
Similar malformed payloads occurred for multiple web tools in the same session (tavily_tavily_search, brave-search_brave_web_search, webfetch).
Environment
- OpenCode version:
1.2.6 - Model:
z-ai/glm5 - Provider: NVIDIA NIM
- OS: macOS Sequoia 15.7.4
Steps to reproduce
- Configure OpenCode to use
z-ai/glm5through NVIDIA NIM. - Ask for a web-research task that triggers multiple MCP/web tool calls.
- Observe some tool calls being emitted with malformed JSON (missing closing braces / truncated payloads).
- Session may enter repeated invalid-call retries.
Expected behavior
Tool arguments should always be valid JSON before execution (or be rejected/recovered with a structured retry).
Actual behavior
Some tool calls are emitted as malformed JSON and fail parser validation, often repeatedly in the same session.
Additional context
Potentially related issues (similar parsing symptoms across models/providers):
- [Bug] JSON Parse Error with Zhipu GLM-4.7: Stream chunks are concatenated incorrectly #7692
- [BUG] Parsing Issue on GLM-4.7 #10731
- 🐛 Bug Report: MCP Tool JSON Parsing Errors on OpenCode (GLM-4.7) #8102
- Error message: JSON Parse error: Expected '}' #12425
I’m unsure whether root cause is parser-side, stream chunk handling, provider behavior, or interaction between them; sharing this report in case the 1.2.x + GLM-5 + NIM combination has a distinct failure mode.