mirror of
https://github.com/langgenius/dify-official-plugins.git
synced 2026-07-21 17:45:23 -04:00
bug: When calling Google models in a multi-turn conversation, an error occurs because thought_signature is not included.
#948
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @BeautyyuYanli on GitHub (Jan 26, 2026).
Originally assigned to: @BeautyyuYanli on GitHub.
Self Checks
Dify version
1.11.4
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
This issue can only be reproduced with Nano Banana Pro. It cannot be reproduced with Nano Banana.
Gemini 3 Pro Preview does not have this problem (but Gemini 3 Pro Preview does not support file output). It is recommended to test gemini-2.5-flash-image / gemini-3-pro-image-preview.
Steps to reproduce
Send an image to Nano Banana Pro and have it process the image.
In the same conversation, reply using Nano Banana and ask it to modify the image.
✔️ Expected Behavior
Multi-turn conversations should be processed correctly.
❌ Actual Behavior
@dosubot[bot] commented on GitHub (Jan 26, 2026):
This error happens because the Gemini plugin does not capture and replay the actual
thought_signaturefrom the Gemini API response in multi-turn conversations. Instead, it uses a static placeholder, which only works for the first image generation. For subsequent turns, the Gemini API requires the exactthought_signaturefrom the previous response; otherwise, it returns a 400 INVALID_ARGUMENT error as described in the Gemini API docs and confirmed in related issues.To resolve this, update the Gemini plugin to version 0.7.0 or later, which correctly handles
thought_signaturepassthrough for multi-turn conversations (details). If updating is not possible, the only reliable workaround is to start a new conversation for each image generation or use a model that does not requirethought_signature(like qwen-max or DeepSeek) for multi-turn tasks.A permanent fix requires code changes so the plugin and core message model capture, persist, and replay the actual
thought_signaturefrom each Gemini response and include it in subsequent requests (reference).To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other
@BeautyyuYanli commented on GitHub (Jan 26, 2026):
Proposal: Preserve thought_signature (and similar provider-specific fields) via opaque_body
1) What is thought_signature?
Through testing, we confirm that thought_signature is a signature attached to a specific content part of a model response (e.g., an image content part).
It is required for certain kinds of content parts, and is not a field for the whole response message or the whole conversation thread.
2) Solution overview: introduce opaque_body for pass-through
To solve the problem (and to future-proof against similar provider-specific requirements), introduce an opaque_body field:
Stores provider-specific opaque metadata for that content part (e.g., thought_signature for an image part).
Reserves space for provider-specific opaque metadata attached to the message as a whole (if any provider needs it later).
This ensures that when the next turn references prior multimodal outputs, all required provider metadata is still available and can be sent back to the provider API.
3) Data persistence & chat history handling in Dify (key focus: Workflow LLM Node)
Dify has multiple code paths that build / transform / store chat history. To make opaque_body truly work, Dify must persist and replay it when reconstructing conversation context.
Key requirement: Workflow LLM Node must store opaque_body (both message-level and content-part-level) into whatever history / state it uses, and include it when assembling the subsequent request payload.
Additionally, any other chat-history handling components should do the same too.
@BeautyyuYanli commented on GitHub (Jan 26, 2026):
A previous fix for Vertex is a temporary workaround because the plugin instance is desgin to be stateless https://github.com/langgenius/dify-official-plugins/pull/2387
@BeautyyuYanli commented on GitHub (Jan 26, 2026):
[PR #26627] fix: Enforce Typed Decorators and Fix Type Errors (langgenius/dify#31499)
[PR #26804] chore(deps): bump opik from 1.7.43 to 1.8.72 in /api (langgenius/dify#31564)
https://github.com/langgenius/dify-plugin-sdks/pull/284
[PR #26798] updating gevent version (langgenius/dify#31566)
https://github.com/langgenius/dify-plugin-daemon/pull/585
@dosubot[bot] commented on GitHub (Jan 26, 2026):
This error happens because Google Gemini models (like Nano Banana Pro) require a
thought_signaturetoken in the image part of the request payload for multi-turn conversations. The plugin is supposed to capture thethought_signaturefrom the previous Gemini API response and replay it in subsequent requests to maintain context. Right now, the Dify Gemini plugin does not do this—it uses a hard-coded placeholder that only works for the first turn, so the second image request fails with a 400 INVALID_ARGUMENT error from the Gemini API [source].The main Dify codebase does not build the Gemini API payload; this logic is in the plugin server, and the parameter is not set anywhere in the main repo [source]. There is no official fix or merged pull request for this issue yet—maintainers have mentioned possible bypasses, but nothing is documented or released [source].
To resolve this, the plugin needs to capture and replay the real
thought_signaturefrom Gemini API responses as described in the Gemini API documentation. For now, the only workaround is to use a different model (like qwen-max), but this does not support Gemini-specific features [source]. If you need Gemini features, you’ll need to monitor plugin updates or consider contributing a patch that implements properthought_signaturehandling.To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other
@crazywoola commented on GitHub (Feb 3, 2026):
Hi @BeautyyuYanli, thanks for opening this issue.
Why this is being closed
Dify issue tracking requires English-only issue title and description for consistent collaboration.
Next steps
Please open a new issue in English and include clear details so maintainers can help efficiently.
Thanks for understanding and for your support.