Skip to content

Function calling works on the first message in a chat, but fails on replies #7902

@andaag

Description

@andaag

📦 Platform

Other, Self hosting Docker

📦 Deploymenet mode

server db(lobe-chat-database image)

📌 Version

1.87.5

💻 Operating System

Other Linux

🌐 Browser

Chrome

🐛 Bug Description

Tool calling with gemini works completly reliably on the first call, but not on new calls within the same thread.

If I start a new thread it will kick off another query just fine, but replies again will break.

How do I debug this?

Image

📷 Recurrence Steps

  1. Start new thread
  2. Ask it to trigger a function call - that will work
  3. Then ask it to do the same thing again - now it fails

🚦 Expected Behavior

No response

📝 Additional Information

In the logs I only get this:

Error: [GoogleGenerativeAI Error]: Failed to parse stream
    at <unknown> (.next/server/edge-chunks/51.js:5:29025)
 ⨯ unhandledRejection:  Error: [GoogleGenerativeAI Error]: Failed to parse stream
    at <unknown> (.next/server/edge-chunks/51.js:5:29025)
[Error: aborted] { code: 'ECONNRESET' }
 ⨯ uncaughtException:  [Error: aborted] { code: 'ECONNRESET' }

We're using gemini-2.5-pro-preview-05-06, which has been excellent at getting function calling right in other repositories.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Geminireleasedunconfirm未被维护者确认的问题🐛 BugSomething isn't working | 缺陷

    Type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions