[bug] Failure to call a tool due to an extra space in the tool name. #2824

Open
opened 2026-02-16 17:37:23 -05:00 by yindo · 7 comments
Owner

Originally created by @burbilog on GitHub (Nov 13, 2025).

Originally assigned to: @rekram1-node on GitHub.

Description

Using Kimi K2 Thinking (and possibly other modes), it often fails because it tries to call tools like " bash" or " edit" instead of "bash" and "edit." After that, OpenCode tends to stop or start looping, repeating the same actions and consuming the quota.

OpenCode version

1.0.62

Steps to reproduce

  1. Select Kimi K2 Thinking
  2. Use it for a while

Screenshot and/or share link

Image Image

Operating System

debian 13

Terminal

yakuake

Originally created by @burbilog on GitHub (Nov 13, 2025). Originally assigned to: @rekram1-node on GitHub. ### Description Using Kimi K2 Thinking (and possibly other modes), it often fails because it tries to call tools like " bash" or " edit" instead of "bash" and "edit." After that, OpenCode tends to stop or start looping, repeating the same actions and consuming the quota. ### OpenCode version 1.0.62 ### Steps to reproduce 1. Select Kimi K2 Thinking 2. Use it for a while ### Screenshot and/or share link <img width="1019" height="127" alt="Image" src="https://github.com/user-attachments/assets/c785c769-61f4-4415-81f5-3ba426e717a7" /> <img width="940" height="61" alt="Image" src="https://github.com/user-attachments/assets/8184999c-eff7-4ab4-a49d-2137701a368e" /> ### Operating System debian 13 ### Terminal yakuake
yindo added the model-problem label 2026-02-16 17:37:23 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Nov 13, 2025):

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

  • #4158: Tool calling loops and failures with certain models - similar symptoms of looping and consuming quota
  • #4263: Another Kimi K2 Thinking model issue with rendering problems - same model affected
  • #4255: Tool calling hangs and failures with LM Studio - similar hanging behavior after tool call failures

While these issues have different root causes (plugin conflicts, rendering issues, empty arrays vs spaces), they all involve tool calling problems that result in hanging, looping, or failure to proceed. The pattern of tool calling failures causing OpenCode to stop or loop appears consistent across these reports.

Feel free to ignore if none of these address your specific case with the extra space in tool names.

@github-actions[bot] commented on GitHub (Nov 13, 2025): This issue might be a duplicate of existing issues. Please check: - #4158: Tool calling loops and failures with certain models - similar symptoms of looping and consuming quota - #4263: Another Kimi K2 Thinking model issue with rendering problems - same model affected - #4255: Tool calling hangs and failures with LM Studio - similar hanging behavior after tool call failures While these issues have different root causes (plugin conflicts, rendering issues, empty arrays vs spaces), they all involve tool calling problems that result in hanging, looping, or failure to proceed. The pattern of tool calling failures causing OpenCode to stop or loop appears consistent across these reports. Feel free to ignore if none of these address your specific case with the extra space in tool names.
Author
Owner

@rekram1-node commented on GitHub (Nov 13, 2025):

What provider is hosting this one?

We can prolly trim prefixed spaces... I doubt many people would have tools that have that...

@rekram1-node commented on GitHub (Nov 13, 2025): What provider is hosting this one? We can prolly trim prefixed spaces... I doubt many people would have tools that have that...
Author
Owner

@burbilog commented on GitHub (Nov 14, 2025):

What provider is hosting this one?
We can prolly trim prefixed spaces... I doubt many people would have tools that have that...

This is from openrouter.ai (very popular one).

@burbilog commented on GitHub (Nov 14, 2025): > What provider is hosting this one? > We can prolly trim prefixed spaces... I doubt many people would have tools that have that... This is from openrouter.ai (very popular one).
Author
Owner

@EasyDevv commented on GitHub (Nov 15, 2025):

It is said that the issue appears in other suppliers except for the main supplier of kimi.

@EasyDevv commented on GitHub (Nov 15, 2025): It is said that the issue appears in other suppliers except for the main supplier of kimi.
Author
Owner

@youcefs21 commented on GitHub (Nov 18, 2025):

Image I believe I'm facing the same issue. I'm on v1.0.72, using kimi k2 thinking using open router + vertex AI

This seems to only happen with this specific command for some reason? when I installed the package manually, and told it the package is installed, it kept going just fine, and is using tools correctly

@youcefs21 commented on GitHub (Nov 18, 2025): <img width="936" height="127" alt="Image" src="https://github.com/user-attachments/assets/583ff35f-58a4-4621-a513-f2a02bb1b244" /> I believe I'm facing the same issue. I'm on v1.0.72, using kimi k2 thinking using open router + vertex AI This seems to only happen with this specific command for some reason? when I installed the package manually, and told it the package is installed, it kept going just fine, and is using tools correctly
Author
Owner

@bodzebod commented on GitHub (Jan 31, 2026):

I happen to have the exact same issue (leading space=error, openrouter and kimi-k2-thinking). Could it be possible to trim the tool name at some point before calling?

@bodzebod commented on GitHub (Jan 31, 2026): I happen to have the exact same issue (leading space=error, openrouter and kimi-k2-thinking). Could it be possible to trim the tool name at some point before calling?
Author
Owner

@burbilog commented on GitHub (Feb 2, 2026):

I just stumbled into this problem with new Kimi 2.5 model:

 invalid [tool= read, error=Model tried to call unavailable tool ' read'. Available tools: invalid, >uedtout. bash, read, glob, grep, edit,
     write, task, webfetch, todowrite, todoread, skill.]  
@burbilog commented on GitHub (Feb 2, 2026): I just stumbled into this problem with new Kimi 2.5 model: ~~~ invalid [tool= read, error=Model tried to call unavailable tool ' read'. Available tools: invalid, >uedtout. bash, read, glob, grep, edit, write, task, webfetch, todowrite, todoread, skill.] ~~~
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2824