Skip to content

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

Closed

Description

@michabbb

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

Activity

  1. tombowditch commented on Jul 15, 2025

    @tombowditch

    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.

  2. jfreeland commented on Jul 15, 2025

    @jfreeland

    smash that subscribe button

  3. tombowditch commented on Jul 15, 2025

    @tombowditch

    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",
    ```
    
  4. pascalandy commented on Jul 15, 2025

    @pascalandy

    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

  5. moesmufti commented on Jul 15, 2025

    @moesmufti

    +1

  6. d3vr commented on Jul 15, 2025

    @d3vr
    Contributor

    @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.

  7. catdevnull commented on Jul 15, 2025

    @catdevnull

    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

  8. michabbb commented on Jul 16, 2025

    @michabbb
    Author

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

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

  9. self-assigned this
    on Jul 16, 2025
  10. delip commented on Sep 14, 2025

    @delip

    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?

  11. yousshim commented on Sep 14, 2025

    @yousshim

    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.

  12. michabbb commented on Sep 14, 2025

    @michabbb
    Author

    yep, i think this issue can be closed now

  13. HugoPodworski commented on Sep 29, 2025

    @HugoPodworski

    {"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.

  14. rekram1-node commented on Sep 29, 2025

    @rekram1-node
    Contributor

    @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?

  15. michabbb commented on Sep 29, 2025

    @michabbb
    Author

    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.

  16. rekram1-node commented on Sep 29, 2025

    @rekram1-node
    Contributor

    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.

  17. added a commit that references this issue on Apr 7, 2026
    5596159
  18. added a commit that references this issue on May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions