Hello,
I’m seeing intermittent malformed tool-call arguments when using z-ai/glm5 via NIM (https://integrate.api.nvidia.com/v1) from an OpenAI-compatible coding client called OpenCode.
Symptom
Tool calls occasionally contain truncated/malformed JSON args, e.g. missing closing }:
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 ‘}’
In the same session, multiple tools can fail similarly (tavily_tavily_search, brave-search_brave_web_search, webfetch), and the client may enter retry loops.
Environment
- Model: z-ai/glm5
- Endpoint: https://integrate.api.nvidia.com/v1
- Client: OpenCode 1.2.6
- OS: macOS Sequoia 15.7.4
Reproduction
- Configure OpenAI-compatible client to use NIM endpoint + z-ai/glm5.
- Run a prompt that triggers several tool/function calls in one turn.
- Observe intermittent malformed tool JSON payloads.
Expected
Tool/function call arguments are always strict valid JSON.
Actual
Occasional malformed JSON in tool arguments causes parser errors and failed tool execution.
Related reports
- OpenCode issue: [BUG] GLM-5 via NVIDIA NIM emits malformed MCP tool JSON (Expected '}') in OpenCode v1.2.6 · Issue #13900 · anomalyco/opencode · GitHub
- GLM-5 issue: [Bug] Malformed tool-call JSON via NVIDIA NIM (GLM-5) causes parser failures in OpenCode · Issue #15 · zai-org/GLM-5 · GitHub
- vLLM issue (similar malformed tool-calls): [Bug]: GLM-5-FP8 malformed tool calls · Issue #34449 · vllm-project/vllm · GitHub
If there is a recommended parser/config/flag set for robust GLM-5 tool-calling via NIM, please share.
Thanks!