Kimi K2 Thinking tool calling problems - missing arguments. #7101

Closed
opened 2026-02-16 18:06:11 -05:00 by yindo · 3 comments
Owner

Originally created by @benys on GitHub (Jan 21, 2026).

Originally assigned to: @fwang on GitHub.

Description

I wanted try Kimi K2 Thinking (OpenCode Zen) model with opencode.
But if I ask any question - file tooling doesn't work.
Also I tried with another tools - for example playwright. It also cannot pass argument to tools

Example:

~ Writing command...
TypeError [ERR_INVALID_ARG_VALUE]: The argument 'file' cannot be empty. Received ''
Open wp.pl in browser.
⚙ playwright_browser_navigate [url=]

Plugins

No response

OpenCode version

1.1.28

Steps to reproduce

  1. Login to OpenCode ZEN - Kimi K2 Thinking
  2. Ask any question about project
  3. Receive many: TypeError [ERR_INVALID_ARG_VALUE]: The argument 'file' cannot be empty. Received ''

Screenshot and/or share link

Image

Operating System

Nixos

Terminal

Alacritty

Originally created by @benys on GitHub (Jan 21, 2026). Originally assigned to: @fwang on GitHub. ### Description I wanted try Kimi K2 Thinking (OpenCode Zen) model with opencode. But if I ask any question - file tooling doesn't work. Also I tried with another tools - for example playwright. It also cannot pass argument to tools Example: ``` ~ Writing command... TypeError [ERR_INVALID_ARG_VALUE]: The argument 'file' cannot be empty. Received '' ``` ``` Open wp.pl in browser. ⚙ playwright_browser_navigate [url=] ``` ### Plugins _No response_ ### OpenCode version 1.1.28 ### Steps to reproduce 1. Login to OpenCode ZEN - Kimi K2 Thinking 2. Ask any question about project 3. Receive many: **TypeError [ERR_INVALID_ARG_VALUE]: The argument 'file' cannot be empty. Received ''** ### Screenshot and/or share link <img width="2475" height="1305" alt="Image" src="https://github.com/user-attachments/assets/cd3f9002-5bcb-4d8b-90b6-97f115519658" /> ### Operating System Nixos ### Terminal Alacritty
yindo added the bugzennix labels 2026-02-16 18:06:11 -05:00
yindo closed this issue 2026-02-16 18:06:11 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 21, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #7512: Tools with array/object parameters fail when LLM sends stringified JSON - similar tool argument validation issues
  • #6918: qwen3-coder fails to call edit tool - similar model/tool parameter issues
  • #9020: Claude models fail on MCP tools with no required parameters (undefined vs {}) - related to empty/invalid arguments
  • #8102: MCP Tool JSON Parsing Errors on OpenCode (GLM-4.7) - similar invalid JSON for tool arguments
  • #6649: Weird error with toolcalling on local model - similar tool calling validation issues
  • #7483: Tools with typed parameters fail when LLM sends stringified parameters

The common thread is that certain models (especially newer/thinking models like Kimi K2) pass invalid or empty arguments to tools, causing validation failures. This appears to be a systematic issue with how some models format tool call arguments.

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Jan 21, 2026): This issue might be a duplicate of existing issues. Please check: - #7512: Tools with array/object parameters fail when LLM sends stringified JSON - similar tool argument validation issues - #6918: qwen3-coder fails to call edit tool - similar model/tool parameter issues - #9020: Claude models fail on MCP tools with no required parameters (undefined vs {}) - related to empty/invalid arguments - #8102: MCP Tool JSON Parsing Errors on OpenCode (GLM-4.7) - similar invalid JSON for tool arguments - #6649: Weird error with toolcalling on local model - similar tool calling validation issues - #7483: Tools with typed parameters fail when LLM sends stringified parameters The common thread is that certain models (especially newer/thinking models like Kimi K2) pass invalid or empty arguments to tools, causing validation failures. This appears to be a systematic issue with how some models format tool call arguments. Feel free to ignore if none of these address your specific case.
Author
Owner

@benys commented on GitHub (Jan 24, 2026):

Maybe newest opencode fixit ? i close

@benys commented on GitHub (Jan 24, 2026): Maybe newest opencode fixit ? i close
Author
Owner

@Rukasufall commented on GitHub (Jan 24, 2026):

Using opencode and Ollama, I’m having the same issue.
I tested the Qwen3-coder:30b and GLM 4.7 Flash:q4_k_m models. They can create a file with code (usually small snippets), but they can’t call it back to edit it.

Glm 4.7 flash:

~ Reading file...
Error: The read tool was called with invalid arguments: [
{
"expected": "string",
"code": "invalid_type",
"path": [
"filePath"
],
"message": "Invalid input: expected string, received undefined"
}
].
Please rewrite the input so it satisfies the expected schema.

Qwen3-coder:30b:

~ Reading file...
Error: The read tool was called with invalid arguments: [
{
"expected": "string",
"code": "invalid_type",
"path": [
"filePath"
],
"message": "Invalid input: expected string, received undefined"
}
].
Please rewrite the input so it satisfies the expected schema.

@Rukasufall commented on GitHub (Jan 24, 2026): Using opencode and Ollama, I’m having the same issue. I tested the Qwen3-coder:30b and GLM 4.7 Flash:q4_k_m models. They can create a file with code (usually small snippets), but they can’t call it back to edit it. Glm 4.7 flash: ~ Reading file... Error: The read tool was called with invalid arguments: [ { "expected": "string", "code": "invalid_type", "path": [ "filePath" ], "message": "Invalid input: expected string, received undefined" } ]. Please rewrite the input so it satisfies the expected schema. Qwen3-coder:30b: ~ Reading file... Error: The read tool was called with invalid arguments: [ { "expected": "string", "code": "invalid_type", "path": [ "filePath" ], "message": "Invalid input: expected string, received undefined" } ]. Please rewrite the input so it satisfies the expected schema.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#7101