mirror of
https://github.com/langgenius/dify-official-plugins.git
synced 2026-07-21 17:45:23 -04:00
Gemini Nano Banana Pro fails when generating a second image in the same conversation (missing thought_signature) #876
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 @MitraSafarinejad on GitHub (Dec 15, 2025).
Self Checks
Dify version
1.9.1
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
When using the Google Gemini nano banana pro to generate images within a single conversation, the first image is generated successfully, but the second image generation fails with a 400 INVALID_ARGUMENT error related to a missing thought_signature.
my gemini plugin version is 0.7.0
I make chatflow and agent and in both i get the same error
Error Message:
Run failed: [google] Error: req_id: b5decf4117 PluginInvokeError: {"args":{},"error_type":"ClientError","message":"400 INVALID_ARGUMENT. {'error': {'code': 400, 'message': 'Image part is missing a thought_signature in content position 2, part position 1. Please refer to https://ai.google.dev/gemini-api/docs/thought-signatures#model-behavior for more details.', 'status': 'INVALID_ARGUMENT'}}"}
✔️ Expected Behavior
The model should generate the second image without errors.
❌ Actual Behavior
The second image generation fails with a client-side 400 INVALID_ARGUMENT error.
@dosubot[bot] commented on GitHub (Dec 15, 2025):
The root cause is that the Gemini plugin (v0.7.0) sets a static placeholder for the thought_signature instead of preserving and forwarding the actual signature returned by the Gemini API in previous responses. The Gemini API requires the exact thought_signature from the last response to be included in subsequent requests for multi-turn interactions; using a static value leads to the 400 INVALID_ARGUMENT error you’re seeing when generating a second image in the same conversation. The plugin currently does not capture or reuse the real thought_signature, so a permanent fix would require changes to store and forward the actual signature as described in the Gemini API docs. There are no workarounds documented in the repo or plugin docs. For now, you may be able to avoid the error by starting a new conversation for each image generation, but multi-turn image generation will not work until the plugin is updated to handle thought_signatures correctly.
Reference: Gemini plugin implementation and PR
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other
@dosubot[bot] commented on GitHub (Dec 15, 2025):
This error happens because the Gemini plugin does not capture and replay the required
thought_signaturetoken from the Gemini API response when making a second image generation request in the same conversation. The Gemini API expects thethought_signaturefrom the previous response to be included in subsequent requests to maintain context, especially for multi-turn tool calls and image generation. Without this, you get a 400 INVALID_ARGUMENT error about a missing thought_signature. This is a known limitation in the current plugin implementation—there is no code path that preserves and reuses the real thought_signature; instead, a hard-coded placeholder is used, which only works for the first turn and fails on the second and beyond [source 1] [source 2].There is no official fix or merged pull request for this yet. Some maintainers have mentioned possible bypass methods, but nothing is documented or released. The only workaround is to use a different model (like qwen-max), but this is not a solution if you need Gemini-specific features [source 3].
If you need this fixed, you’ll need to monitor for plugin updates or consider contributing a patch that properly captures and replays the thought_signature as described in the Gemini API docs.
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other