Skip to content

[Bug] Gemini 3 Pro in OpenRouter throws error when a tool is used #37

Description

@aleksandaryanakiev

We were testing Gemini 3 Pro through OpenRouter and when the LLM calls an MCP we are getting this error

2025-11-25 15:24:51 error: [api/server/controllers/agents/client.js #chatCompletion] Error during completion 400 Provider returned error { "status": 400, "headers": {}, "requestID": null, "error": { "message": "Provider returned error", "code": 400, "metadata": { "raw": "Gemini models require OpenRouter reasoning details to be preserved in each request. Please refer to our docs: https://openrouter.ai/docs/use-cases/reasoning-tokens#preserving-reasoning-blocks. Upstream error: {\n \"error\": {\n \"code\": 400,\n \"message\": \"Function call is missing a thought_signature in functionCall parts. This is required for tools to work correctly, and missing thought_signature may lead to degraded model performance. Additional data, function call default_api:search_knowledge_base , position 2. Please refer to https://ai.google.dev/gemini-api/docs/thought-signatures for more details.\",\n \"status\": \"INVALID_ARGUMENT\"\n }\n}\n", "provider_name": "Google AI Studio" } }, "code": 400, "attemptNumber": 1, "retriesLeft": 6, "pregelTaskId": "4381904b-e83e-51c0-b979-f959b46a28a7" } 2025-11-25T13:24:51.438Z debug: [spendTokens] conversationId: 27d2c929-73a2-48e2-a954-aa2c6672217b | Context: message | Token usage: { promptTokens: 24, completionTokens: 181, }

From my understanding LangChain is dropping it somewhere and we are not passing it to OpenRouter and this fails the request

Activity

  1. danny-avila commented on Nov 25, 2025

    @danny-avila
    Collaborator
  2. danny-avila commented on Nov 26, 2025

    @danny-avila
    Collaborator
  3. danny-avila commented on Dec 1, 2025

    @danny-avila
    Collaborator

    It looks like we can work around this. Resolved here, merging to LC repo soon:

    294d7dc

    Image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions