groq + kimi k2: Failed to call a function #733

Closed
opened 2026-02-16 17:28:03 -05:00 by yindo · 15 comments
Owner

Originally created by @michabbb on GitHub (Jul 15, 2025).

Originally assigned to: @thdxr on GitHub.

stops working after a few chats with the error:

{"message":"Failed to call a function. Please adjust your prompt. See 'failed_generation' for more details.","type":"invalid_request_error"}

😢

if you need anything to debug that, let me know where to find the logs

Originally created by @michabbb on GitHub (Jul 15, 2025). Originally assigned to: @thdxr on GitHub. stops working after a few chats with the error: ``` {"message":"Failed to call a function. Please adjust your prompt. See 'failed_generation' for more details.","type":"invalid_request_error"} ``` 😢 if you need anything to debug that, let me know where to find the logs
yindo added the model-problem label 2026-02-16 17:28:03 -05:00
yindo closed this issue 2026-02-16 17:28:03 -05:00
Author
Owner

@tombowditch commented on GitHub (Jul 15, 2025):

FWIW, I'm seeing this too - maybe 80% of calls are failing. It eventually works if I keep telling it "continue" but fails fairly often.

@tombowditch commented on GitHub (Jul 15, 2025): FWIW, I'm seeing this too - maybe 80% of calls are failing. It eventually works if I keep telling it "continue" but fails fairly often.
Author
Owner

@jfreeland commented on GitHub (Jul 15, 2025):

smash that subscribe button

@jfreeland commented on GitHub (Jul 15, 2025): smash that subscribe button
Author
Owner

@tombowditch commented on GitHub (Jul 15, 2025):

It's not much help, but I've dumped and raw body from Groq and we get:

body: "event: error\ndata: {\"error\":{\"message\":\"Failed to call a function. Please adjust your prompt. See 'failed_generation' for more details.\",\"type\":\"invalid_request_error\",\"code\":\"tool_use_failed\",\"failed_generation\":\"Tool use failed: JSON does not match the expected schema for tool calls\",\"status_code\":400}}\n\n",
```
@tombowditch commented on GitHub (Jul 15, 2025): It's not much help, but I've dumped and raw body from Groq and we get: ```` body: "event: error\ndata: {\"error\":{\"message\":\"Failed to call a function. Please adjust your prompt. See 'failed_generation' for more details.\",\"type\":\"invalid_request_error\",\"code\":\"tool_use_failed\",\"failed_generation\":\"Tool use failed: JSON does not match the expected schema for tool calls\",\"status_code\":400}}\n\n", ```
Author
Owner

@pascalandy commented on GitHub (Jul 15, 2025):

Same :-/

Log from my groc account

{
  "request_id": "req_01k07kynmtfdwvgajp3k23cbb0",
  "created_at": "2025-07-15T18:01:05.946Z",
  "error": {
    "message": "Failed to call a function. Please adjust your prompt. See 'failed_generation' for more details.",
    "type": "invalid_request_error",
    "param": "",
    "code": "tool_use_failed"
  }
}

Image

@pascalandy commented on GitHub (Jul 15, 2025): Same :-/ Log from my groc account ````shell { "request_id": "req_01k07kynmtfdwvgajp3k23cbb0", "created_at": "2025-07-15T18:01:05.946Z", "error": { "message": "Failed to call a function. Please adjust your prompt. See 'failed_generation' for more details.", "type": "invalid_request_error", "param": "", "code": "tool_use_failed" } } ```` ![Image](https://github.com/user-attachments/assets/0be0f875-dccc-44c7-967e-69248b5d0f1d)
Author
Owner

@moesmufti commented on GitHub (Jul 15, 2025):

+1

@moesmufti commented on GitHub (Jul 15, 2025): +1
Author
Owner

@d3vr commented on GitHub (Jul 15, 2025):

@everyone, please use the Subscribe button on the right sidebar to get notified on progress in this issue instead of spamming it with "+1" (which is not helpful in any way), thank you.

@d3vr commented on GitHub (Jul 15, 2025): `@everyone`, please use the `Subscribe` button on the right sidebar to get notified on progress in this issue instead of spamming it with "+1" (which is not helpful in any way), thank you.
Author
Owner

@catdevnull commented on GitHub (Jul 15, 2025):

updates from groq team: https://community.groq.com/discussion-forum-7/groq-kimi-k2-tool-call-issues-213

Hi there, I’ve reported this to the Kimi team; we’re adding a ton of optimizations right now, will get it fixed ASAP

@catdevnull commented on GitHub (Jul 15, 2025): updates from groq team: https://community.groq.com/discussion-forum-7/groq-kimi-k2-tool-call-issues-213 >Hi there, I’ve reported this to the Kimi team; we’re adding a ton of optimizations right now, will get it fixed ASAP
Author
Owner

@michabbb commented on GitHub (Jul 16, 2025):

https://x.com/omarkilani/status/1945139550352732217

but today i still got errors and had to start a new conversation multiple times 😢

@michabbb commented on GitHub (Jul 16, 2025): https://x.com/omarkilani/status/1945139550352732217 but today i still got errors and had to start a new conversation multiple times 😢
Author
Owner

@delip commented on GitHub (Sep 13, 2025):

Hi All, I am digging through a bunch of issues related to this and I am not getting any clarity on the current status of a fix or a proposed solution.

Using groq/moonshotai/kimi-k2-instruct-0905 with a fresh run:

opencode run "compute the sum of first 100 primes and divide by the log of their product"

fails with

Error: {"message":"tool call validation failed: attempted to call tool 'python' which was not in request.tools","type":"invalid_request_error"}

Note: simple prompts seem to work such as:
opencode run "tell me a joke"

config details:

$ opencode --version
0.7.9

$  node --version
v22.16.0

Can someone share where we are with this?

@delip commented on GitHub (Sep 13, 2025): Hi All, I am digging through a bunch of issues related to this and I am not getting any clarity on the current status of a fix or a proposed solution. Using `groq/moonshotai/kimi-k2-instruct-0905` with a fresh run: `opencode run "compute the sum of first 100 primes and divide by the log of their product"` fails with ``` Error: {"message":"tool call validation failed: attempted to call tool 'python' which was not in request.tools","type":"invalid_request_error"} ``` Note: simple prompts seem to work such as: `opencode run "tell me a joke"` config details: ``` $ opencode --version 0.7.9 $ node --version v22.16.0 ``` Can someone share where we are with this?
Author
Owner

@yousshim commented on GitHub (Sep 14, 2025):

There was an issue on groq when kimi k2 was first released that was fixed from their side a while back.

Looking at the error message it seems it's a model issue hallucinating a tool that does not exist.

Is it falling consistently with the prompt you shared. If so you can try replacing the word "compute" with "write a python script that calculates". My guess is the model is trying to give you an answer by using python as a calculator rather than giving the script.

@yousshim commented on GitHub (Sep 14, 2025): There was an issue on groq when kimi k2 was first released that was fixed from their side a while back. Looking at the error message it seems it's a model issue hallucinating a tool that does not exist. Is it falling consistently with the prompt you shared. If so you can try replacing the word "compute" with "write a python script that calculates". My guess is the model is trying to give you an answer by using python as a calculator rather than giving the script.
Author
Owner

@michabbb commented on GitHub (Sep 14, 2025):

yep, i think this issue can be closed now

@michabbb commented on GitHub (Sep 14, 2025): yep, i think this issue can be closed now
Author
Owner

@HugoPodworski commented on GitHub (Sep 29, 2025):

{"error":{"message":"Failed to call a function. Please adjust your prompt. See 'failed_generation' for more details.","type":"invalid_request_error","code":"tool_use_failed","failed_generation":"\u003c|tool_calls_section_begin|\u003e\u003c|tool_calls_section_begin|\u003e función check_check_availability:0 = {"appointment_type": "consultation", "start_time": "This Friday 8am", "end_time": "This Friday 11pm"}\u003c|tool_call_end|\u003e\u003c|tool_calls_section_end|\u003e"}}

Issue doesn't seem to be fixed yet.

@HugoPodworski commented on GitHub (Sep 29, 2025): {"error":{"message":"Failed to call a function. Please adjust your prompt. See 'failed_generation' for more details.","type":"invalid_request_error","code":"tool_use_failed","failed_generation":"\u003c|tool_calls_section_begin|\u003e\u003c|tool_calls_section_begin|\u003e función check_check_availability:0 = {\"appointment_type\": \"consultation\", \"start_time\": \"This Friday 8am\", \"end_time\": \"This Friday 11pm\"}\u003c|tool_call_end|\u003e\u003c|tool_calls_section_end|\u003e"}} Issue doesn't seem to be fixed yet.
Author
Owner

@rekram1-node commented on GitHub (Sep 29, 2025):

@HugoPodworski this is an issue on Groq's end seems to me, not sure what we could do about it unless you had something in mind?

@rekram1-node commented on GitHub (Sep 29, 2025): @HugoPodworski this is an issue on Groq's end seems to me, not sure what we could do about it unless you had something in mind?
Author
Owner

@michabbb commented on GitHub (Sep 29, 2025):

Yesterday, I tested opencode Zen with Kimi (for the first time), and I didn't get a single tool call error. That said, this really looks like a provider issue. Sadly, it looks like we have to choose between speed and accuracy 😔
I prefer accuracy.

@michabbb commented on GitHub (Sep 29, 2025): Yesterday, I tested opencode Zen with Kimi (for the first time), and I didn't get a single tool call error. That said, this really looks like a provider issue. Sadly, it looks like we have to choose between speed and accuracy 😔 I prefer accuracy.
Author
Owner

@rekram1-node commented on GitHub (Sep 29, 2025):

That's great to hear @michabbb thx for adding that, when the team was working on provider selection for zen one of the things they noticed is providers like groq and a lot of others tend to error constantly either tool calls or network failures, so I am glad at least anecdotally you are having a better experience with zen.

@rekram1-node commented on GitHub (Sep 29, 2025): That's great to hear @michabbb thx for adding that, when the team was working on provider selection for zen one of the things they noticed is providers like groq and a lot of others tend to error constantly either tool calls or network failures, so I am glad at least anecdotally you are having a better experience with zen.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#733