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
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
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
c/c @zikajk
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.
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.
@CsBigDataHub Which provider / model were you using? Are you paying for Mistral API?
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": {}
}
}
@CsBigDataHub can you check if master fixes your issue after #243
works as expected, thank you @zikajk and @ericdallo.
@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}}
}}