Tool Calling Issues with Gemini Flash 2.0
# support
g
Hi there, I am getting errors when using Gemini Flash 2.0, specifically with regards to tool calling the tools work correctly when using GPT-4o mini, however, keep on getting these errors when using Gemini Flash: 6:37:08:086 [WARN] Model request failed (attempt #1, reason: ([VertexAI.ClientError]: got status: 400 Bad Request. {"error":{"code":400,"message":"Invalid JSON payload received. Unknown name \"text\" at 'contents[10].parts[0]': Proto field is not repeating, cannot start list.","status":"INVALID_ARGUMENT","details":[{"@type":"type.googleapis...)) 16:37:08:588 [WARN] Model request failed (attempt #2, reason: ([VertexAI.ClientError]: got status: 400 Bad Request. {"error":{"code":400,"message":"Invalid JSON payload received. Unknown name \"text\" at 'contents[10].parts[0]': Proto field is not repeating, cannot start list.","status":"INVALID_ARGUMENT","details":[{"@type":"type.googleapis...))
k
Hey! To help track down this issue, could you share: - The call ID This would really help us figure out what went wrong!
g
@User Here are some calls that had issues: - a6b1ca7a-53c6-4517-a612-e7eeb409a7dc - af043760-533a-48ff-993e-4f59bf64a673 - 0bea8921-57c5-40f4-a1a3-78c1fee73f00 Been having an issue with Gemini Tool calling in general outside using Vapi where it mentions the message had an empty text parameter so not sure if it is the same issue with you guys. Thanks for the help.
k
he error message you're encountering indicates a problem with the JSON payload sent to the Vertex AI service. Specifically, the message "Unknown name 'text' at 'contents\[10\].parts\[0\]': Proto field is not repeating, cannot start list." suggests that the field 'text' is not expected in the current context, or it's being provided in an incorrect format.
Most likely it's on our side let me ask the team to work on it.
Fixed, can you try again?
g
@User tried again but unfortunatley got the same error here is the latest call id: a0810215-1d0e-4943-8bfa-e018d24603c8
k
Thanks George for following up. Let me share the call ID with the team, and I'll get back to you with the updates.
George, the issue has been raised with the team, and soon it will be fixed/resolved for you.
g
Thanks very much!
k
Marking this ticket as Solved ✅
g
@User Hi Shubham, unfortunately it is still not solved, just tried again and still getting the error. It is only with Gemini models that the tool calling error occurs:
Copy code
Model request failed (attempt #2, reason: ([VertexAI.ClientError]: got status: 400 Bad Request. {"error":{"code":400,"message":"Invalid JSON payload received. Unknown name \"text\" at 'contents[7].parts[0]': Proto field is not repeating, cannot start list.","status":"INVALID_ARGUMENT","details":[{"@type":"type.googleapis....))
k
Hi, checking if this is resolved/solved for you?
g
Hi, no the error still persists. I can see the tool call result appearing in the messages whihc suggests that the result is being returned correctly my end. The result returns an array of strings but always encontering the same error as above. here is the most recent call id: 6f607c1e-98cb-430a-aed4-bffbfa7b664d
k
Let me check with the team again about this.
g
Thanks very much
k
We’ve looked into your request and the logs associated with the Google
400 INVALID_ARGUMENT
error. Here’s what we’ve found: 1. Why the Error Occurs - The logs show your system is sending requests to Gemini/Vertex in a format that includes multiple
"parts"
arrays with
"text"
fields. - Google’s LLM endpoint expects one continuous string of
"content"
per message; it does not support
"parts"
or nested
"text"
arrays. - This discrepancy causes the
INVALID_ARGUMENT
error. 2. Why We’re Not Considering It a Platform Issue - The request payload includes large blocks of internal prompt tags (e.g.,
<who_you_are>
,
<skill_graph>
, etc.) and an array of “text” fields, which appear to come from an internal AI testing setup. - In normal production usage, these tags or arrays wouldn’t be passed to Vertex. - Essentially, the platform works for standard calls that flatten messages into `"content"`; the unusual “parts” format is unique to your test scenario. 3. Recommended Next Steps for You - Flatten your messages so each message has a top-level
"content"
string rather than an array of
"parts"
. - Remove any raw
<xml>
or
<skill_graph>
tags from the final payload before sending to Google. - If your conversation includes a list of times or other data, convert it to a single string or break it into multiple simple messages (again, each with
"content"
). 4. Bottom Line - The error arises from JSON formatting that Vertex/Gemini doesn’t allow. - This is not a bug in Gemini or the API; it’s a matter of conforming to Google’s message schema. - Once you adjust the message format and remove the extra
"parts"
arrays, your requests should process correctly. I hope that clarifies what happened and how you can address it on your side. If you have any more questions, feel free to let me know!
g
Perfect, thanks very much for your help. Have managed to get it working.
k
Awesome.
3 Views