Gemini 2.5 Pro - Tool Call Looping Bug - Reason for v high bills?

I’ve been usinng Gemini 2.5 pro, however, it will sporadically go into a loop where it continues to call a tool for several hours.

This relates to the call that took 5000+ seconds in the trace log above. Each time it successfully calls the tool. But then continue again. In some cases it has gone on for 37 hours.

However, then the same prompt is run again a few minutes later, it is fine and completes within a few seconds (see trace logs above).

Here are the error logs

Here is my billing chart.

Yesterday my app made 83 calls the gemini pro endpoint and it cost more than £400!!!

I’d be grateful if someone can look into this urgently. I’ve moved my workloads over to open AI from this morning and I’m not seeing any errors.

Hello,

Just to clarify our understanding, you are facing an unnecessary loop during tool calling where you intentionally try to call a tool but the model keeps looping and returning the tool in a single call.
If that is correct, we would need to analyze this issue further. Could you please share your prompts and the relevant snippet of your code so that we can try to reproduce the issue and provide a more accurate solution?

Hello! Do you have any updates about this issue? I’m experiencing same issue almost in 70% interactions from 4 Nov 2025 (Gemini 2.5 flash)
The model seems to enter a loop, repeatedly invoking the same tool mostly with identical arguments — even after receiving a valid response.
I noticed it often happens when user sends similar instructoins more than once
Example:

  • The user sends an instruction, e.g.:
    add product 373992459 to cart, quantity 1
  • Gemini issues a function call
{
  "name": "shopping-cart-tool",
  "arguments": {
    "add_products": [{ "product_id": 123, "quantity": 1 }]
  }
}
  • The tool returns a valid response
{
  "output": "[{\"product_id\":123,\"quantity\":1}]"
}
  • The user sends an instruction, e.g.:
    add product 123 to cart, quantity 5

  • Gemini issues a function call

{
  "name": "shopping-cart-tool",
  "arguments": {
    "add_products": [{ "product_id": 123, "quantity": 5 }]
  }
}
  • The tool returns a valid response
{
  "output": "[{\"product_id\":123,\"quantity\":5}]"
}
  • Instead of proceeding with a normal text reply (e.g. “Item added to cart”), the model immediately issues the same function call again, with identical arguments.

  • Even when the tool responds with:

{ "error": "\"Multiple calls with the same arguments are not allowed.\"" }
  • the model continues to invoke the same function — resulting in a

functionCall → functionResponse → functionCall → ...