eca icon indicating copy to clipboard operation
eca copied to clipboard

Mistral AI API tool call id mismatch - Tool call id was 2968-LWy3uasib but must be a-z, A-Z, 0-9, with a length of 9

Open ChetanKoneru opened this issue 11 months ago • 9 comments

error -

LLM response status: 400 body: {"object":"error","message":"Tool call id was 2968-LWy3uasib but must be a-z, A-Z, 0-9, with a length of 9.","type":"invalid_function_call","param":null,"code":"3280"}

Mistral API needs tool call id's in this format - must be a-z, A-Z, 0-9, with a length of 9

ChetanKoneru avatar Dec 13 '25 18:12 ChetanKoneru

Interesting, this happens because of here, can you try to remove that prefix and leave only id without rid and test it?

I don't recall exactly why we added that prefix, but I didn't think it would cause any harm, maybe we should remove it or understand how to avoid that

ericdallo avatar Dec 13 '25 19:12 ericdallo

c/c @zikajk

ericdallo avatar Dec 13 '25 19:12 ericdallo

I believe we did that to stop tool call IDs from being duplicated. That issue popped up when I switched the conversation's provider or model. Or when the same provider reused IDs between requests. I do not remember which exact situation it was.

I will do some tests to find out how it is still relevant.

zikajk avatar Dec 14 '25 08:12 zikajk

I found the problem, I will try take the approach from anthropic implementation and will reset atom on each request, then it should be safe to keep the original ID.

zikajk avatar Dec 14 '25 11:12 zikajk

@CsBigDataHub Which provider / model were you using? Are you paying for Mistral API?

zikajk avatar Dec 19 '25 12:12 zikajk

Hi @zikajk ,

https://mistral.ai/news/devstral-2-vibe-cli

devstral-2-small is free to use during the trail period, I have been using that.

see - https://github.com/editor-code-assistant/eca/issues/231

"mistral": {
      "api": "openai-chat",
      "url": "https://api.mistral.ai",
      "completionUrlRelativePath": "/v1/chat/completions",
      "key": "XXXXXXXXX",
      "models": {
        "labs-devstral-small-2512": {}
      }
    }

ChetanKoneru avatar Dec 20 '25 19:12 ChetanKoneru

@CsBigDataHub can you check if master fixes your issue after #243

ericdallo avatar Dec 21 '25 14:12 ericdallo

works as expected, thank you @zikajk and @ericdallo.

ChetanKoneru avatar Dec 21 '25 15:12 ChetanKoneru

@CsBigDataHub I also had to update the extraPayload to avoid this error: LLM response status: 422 body: {"object":"error","message":{"detail":[{"type":"extra_forbidden","loc":["body","max_completion_tokens"],"msg":"Extra inputs are not permitted","input":32000}]},"type":"invalid_request_error","param":null,"code":null}

And you can omit completionUrlRelativePath (chat/completions is the default one). So this is a final configuration that works:

{
     "api": "openai-chat",
     "url": "https://api.mistral.ai/v1",
     "key": ".....",
     "models": {
       "labs-devstral-small-2512": {"extraPayload": {"max_completion_tokens": null}}
     }}

zikajk avatar Dec 21 '25 16:12 zikajk