Skip to content

[BUG] GLM-5 via NVIDIA NIM emits malformed MCP tool JSON (Expected '}') in OpenCode v1.2.6 #13900

@chindris-mihai-alexandru

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

  1. Configure OpenCode to use z-ai/glm5 through NVIDIA NIM.
  2. Ask for a web-research task that triggers multiple MCP/web tool calls.
  3. Observe some tool calls being emitted with malformed JSON (missing closing braces / truncated payloads).
  4. 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):

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions