Significant Latency Increase & Errors with Images in Gemini Plugin v0.0.6+ #169

Closed
opened 2026-02-16 10:18:19 -05:00 by yindo · 9 comments
Owner

Originally created by @Hzao on GitHub (Apr 3, 2025).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues Dify issues & Dify Official Plugins, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.1.3

Plugin version

0.0.6 and plus

Cloud or Self Hosted

Cloud

Steps to reproduce

Description:

Since updating the Dify Gemini plugin (https://marketplace.dify.ai/plugins/langgenius/gemini) to version 0.0.6 or later, I've encountered two critical issues with the vision model:

  1. Significant Latency Increase: Tasks involving image processing, which previously took around 5 seconds, now require approximately 1 minute. This delay is not observed in plugin versions prior to 0.0.6, or when using the same model through OpenRouter (where execution times remain within the 2-5 second range).
  2. Errors with Larger Images: When processing images around 5MB in size, the plugin consistently returns errors, preventing successful task completion.

These 2 issues seem related: The latency issue appears to be related to image size, as smaller images (1MB) exhibit shorter processing times, but still longer than previous versions.

Steps to Reproduce:

Issue Environment

Dify with Gemini plugin version 0.0.6 or later.

Model

Google Gemini 2.0 Flash 001

Input

Calling the model with an image (You can find the image I'm using in the attachment).

Task

Perform a task that utilizes the vision capabilities of the model (e.g., image analysis, description).

You can try with my exported DSL and all my testing images in attachment.zip too.

attachments.zip

Comparison (Testing with IMG_Normal.png, with the size of 3.1 MB)

  • Gemini plugin version 0.0.6 or later (Where the issue exists) : LLM processing time approximately 69 seconds.(Too Slow)

Image

  • Gemini plugin version 0.0.5: LLM processing time approximately 5.9 seconds. (Acceptable)

Image

  • OpenRouter (same model): LLM processing time approximately 3.0 seconds.(Acceptable)

Image

Issue with file size

I noticed that, this issue might be related to file size:

  • If we try an image with a smaller file size (750KB): LLM processing time approximately 8.0 seconds. (Less likely to be noticed, but still too slow)

Image

-If we try with a 2.6MB image: 41 seconds. (Too Slow)

Image

  • If we try an image with a larger size (5.7 MB). (🚨we hit an error )

Image

[google] Error: PluginInvokeError: {"args":null,"error_type":"PluginDaemonInnerError","message":"encountered an error: invalid character '\u003c' looking for beginning of value status: 502 Bad Gateway original response: \u003chtml\u003e"}

2-6MB image inputs are common use cases, and 1 minute of processing time is excessively long. So I hope this information is helpful in resolving the issue.

✔️ Error log

No response

Originally created by @Hzao on GitHub (Apr 3, 2025). ### Self Checks - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [Dify issues](https://github.com/langgenius/dify/issues) & [Dify Official Plugins](https://github.com/langgenius/dify-official-plugins/issues), including closed ones. - [x] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.1.3 ### Plugin version 0.0.6 and plus ### Cloud or Self Hosted Cloud ### Steps to reproduce ## Description: Since updating the Dify Gemini plugin (https://marketplace.dify.ai/plugins/langgenius/gemini) to version 0.0.6 or later, I've encountered two critical issues with the vision model: 1. Significant Latency Increase: Tasks involving image processing, which previously took around 5 seconds, now require approximately 1 minute. This delay is not observed in plugin versions prior to 0.0.6, or when using the same model through OpenRouter (where execution times remain within the 2-5 second range). 2. Errors with Larger Images: When processing images around 5MB in size, the plugin consistently returns errors, preventing successful task completion. These 2 issues seem related: The latency issue appears to be related to image size, as smaller images (1MB) exhibit shorter processing times, but still longer than previous versions. ## Steps to Reproduce: ### Issue Environment Dify with Gemini plugin version 0.0.6 or later. ### Model Google Gemini 2.0 Flash 001 ### Input Calling the model with an image (You can find the image I'm using in the attachment). ### Task Perform a task that utilizes the vision capabilities of the model (e.g., image analysis, description). You can try with my exported DSL and all my testing images in attachment.zip too. [attachments.zip](https://github.com/user-attachments/files/19580115/attachments.zip) ### **Comparison (Testing with IMG_Normal.png, with the size of 3.1 MB)** - Gemini plugin version 0.0.6 or later (Where the issue exists) : LLM processing time approximately 69 seconds.(❌Too Slow) ![Image](https://github.com/user-attachments/assets/79bc97fa-8439-4b7d-8374-0cb7b3b24df5) - Gemini plugin version 0.0.5: LLM processing time approximately 5.9 seconds. (✅Acceptable) ![Image](https://github.com/user-attachments/assets/882fe47c-5de9-4fd1-9569-78894fbbcfda) - OpenRouter (same model): LLM processing time approximately 3.0 seconds.(✅Acceptable) ![Image](https://github.com/user-attachments/assets/18f8091d-4f76-4ba7-91fc-bc5a2f870e4e) ### Issue with file size I noticed that, this issue might be related to file size: - If we try an image with a smaller file size (750KB): LLM processing time approximately 8.0 seconds. (❌Less likely to be noticed, but still too slow) ![Image](https://github.com/user-attachments/assets/89084b14-3385-4b19-ae09-5caba1f9091b) -If we try with a 2.6MB image: 41 seconds. (❌Too Slow) ![Image](https://github.com/user-attachments/assets/ae2b6f24-d036-4ea4-9914-15ee5b50d4da) - If we try an image with a larger size (5.7 MB). (🚨we hit an error ) ![Image](https://github.com/user-attachments/assets/69e59f1c-6a5e-4f16-8136-c9ad1a617f29) ``` [google] Error: PluginInvokeError: {"args":null,"error_type":"PluginDaemonInnerError","message":"encountered an error: invalid character '\u003c' looking for beginning of value status: 502 Bad Gateway original response: \u003chtml\u003e"} ``` 2-6MB image inputs are common use cases, and 1 minute of processing time is excessively long. So I hope this information is helpful in resolving the issue. ### ✔️ Error log _No response_
yindo added the bug label 2026-02-16 10:18:19 -05:00
yindo closed this issue 2026-02-16 10:18:19 -05:00
Author
Owner

@hjlarry commented on GitHub (Apr 3, 2025):

I can't reproduce it on cloud.dify.ai, use your dsl, not change anything

image normal

Image

image large

Image

@hjlarry commented on GitHub (Apr 3, 2025): **I can't reproduce it on `cloud.dify.ai`, use your dsl, not change anything** ### image normal ![Image](https://github.com/user-attachments/assets/2fe7d150-dfda-474d-bb3c-aee9cc9a00a2) ### image large ![Image](https://github.com/user-attachments/assets/d60aaee9-3bc7-44f8-857f-d1ac14086708)
Author
Owner

@Hzao commented on GitHub (Apr 3, 2025):

I can't reproduce it on cloud.dify.ai, use your dsl, not change anything

image normal

Image

image large

Image

All my previous tests were also operated on cloud.dify.ai, on both plugin version v0.0.6 & v0.1.1.

Can you confirm your plugin version?

@Hzao commented on GitHub (Apr 3, 2025): > **I can't reproduce it on `cloud.dify.ai`, use your dsl, not change anything** > > ### image normal > ![Image](https://github.com/user-attachments/assets/2fe7d150-dfda-474d-bb3c-aee9cc9a00a2) > > ### image large > ![Image](https://github.com/user-attachments/assets/d60aaee9-3bc7-44f8-857f-d1ac14086708) All my previous tests were also operated on cloud.dify.ai, on both plugin version v0.0.6 & v0.1.1. Can you confirm your plugin version?
Author
Owner

@hjlarry commented on GitHub (Apr 3, 2025):

My plugin version is v0.1.2, but versions 0.1.2 and 0.1.1 are almost identical.

@hjlarry commented on GitHub (Apr 3, 2025): My plugin version is v0.1.2, but versions `0.1.2` and `0.1.1` are almost identical.
Author
Owner

@Hzao commented on GitHub (Apr 3, 2025):

My plugin version is v0.1.2, but versions 0.1.2 and 0.1.1 are almost identical.

I tried it out, and still, I can reproduce the issue on v0.1.2 and when switched back to v0.0.5, it's back to normal.

This is a demo video that I recorded, in which I use v0.1.2 first but failed, then switched to v0.0.5 and succeeded.

https://github.com/user-attachments/assets/e4a3546f-5e17-4de1-af38-a52c1beed979

(Although it's recorded using Safari, I can reproduce it in Chrome based browser too.)

I recommend you switch gemini plugin version back and forth, and refresh the browser to make sure it takes effect.

@Hzao commented on GitHub (Apr 3, 2025): > My plugin version is v0.1.2, but versions `0.1.2` and `0.1.1` are almost identical. I tried it out, and still, I can reproduce the issue on v0.1.2 and when switched back to v0.0.5, it's back to normal. This is a demo video that I recorded, in which I use v0.1.2 first but failed, then switched to v0.0.5 and succeeded. https://github.com/user-attachments/assets/e4a3546f-5e17-4de1-af38-a52c1beed979 (Although it's recorded using Safari, I can reproduce it in Chrome based browser too.) I recommend you switch gemini plugin version back and forth, and refresh the browser to make sure it takes effect.
Author
Owner

@hjlarry commented on GitHub (Apr 5, 2025):

I have encountered this issue both in the cloud environment and my local setup, and it’s quite strange.

As you can see, the update only added a model configuration. I also reviewed the plugin-daemon changes between Feb 27 and Mar 2, but there doesn’t seem to be anything related to this issue.

@Yeuoly Could you assist in debugging this problem?

@hjlarry commented on GitHub (Apr 5, 2025): I have encountered this issue both in the cloud environment and my local setup, and it’s quite strange. - **Feb 27**: Changes in version 0.0.5 - see details here: https://github.com/langgenius/dify-official-plugins/pull/287/files - **Mar 2**: Changes in version 0.0.6 - see details here: https://github.com/langgenius/dify-official-plugins/pull/346/files As you can see, the update only added a model configuration. I also reviewed the plugin-daemon changes between Feb 27 and Mar 2, but there doesn’t seem to be anything related to this issue. @Yeuoly Could you assist in debugging this problem?
Author
Owner

@linqinguang commented on GitHub (Apr 9, 2025):

I also encountered the same problem. I used 4 model providers, and after troubleshooting, I obtained the following information which may be helpful:

  1. When the multimodal model executes the image understanding task, the printed reply content has a large delay, which is twice as slow as v0.15 (currently it is the community version, dify-api: 1.2.0, plugins-daemon: 0.0.7-local);
  2. The printing speed of the multimodal model is normal when performing pure text tasks;
  3. When the multimodal model is under multi-concurrency or multi-model debugging, the printing speed drops rapidly. A 15-second task takes 300 seconds to complete;
  4. I used Postman or directly called the multimodal model on the server using CURL to understand the image, and the completion time is the same as that of v0.15.
  5. The only problematic log in docker is
/app/api/.venv/lib/python3.12/site-packages/pydantic/main.py:390: UserWarning: Pydantic serializer warnings:
  PydanticSerializationUnexpectedValue: Expected `str` but got `list` with value `[TextPromptMessageContent...il=<DETAIL.LOW: 'low'>)]` - serialized value may not be as expected
  PydanticSerializationUnexpectedValue: Expected `PromptMessageContent` but got `TextPromptMessageContent` with value `TextPromptMessageContent(...'背诵一下这首诗')` - serialized value may not be as expected
  return self.__pydantic_serializer__.to_python(

The 4 providers are shown in the figure.
Image

The version of each plugin is as follows:

  • 火山方舟/volcengine_maas : 0.0.10
  • OpenAI-API-compatible : 0.0.12
  • 通义千问/tongyi : 0.0.16
  • Azure OpenAI : 0.0.12
@linqinguang commented on GitHub (Apr 9, 2025): I also encountered the same problem. I used 4 model providers, and after troubleshooting, I obtained the following information which may be helpful: 1. When the multimodal model executes the image understanding task, the printed reply content has a large delay, which is twice as slow as v0.15 (currently it is the community version, dify-api: 1.2.0, plugins-daemon: 0.0.7-local); 2. The printing speed of the multimodal model is normal when performing pure text tasks; 3. When the multimodal model is under multi-concurrency or multi-model debugging, the printing speed drops rapidly. A 15-second task takes 300 seconds to complete; 4. I used Postman or directly called the multimodal model on the server using CURL to understand the image, and the completion time is the same as that of v0.15. 5. The only problematic log in docker is ```plaintext /app/api/.venv/lib/python3.12/site-packages/pydantic/main.py:390: UserWarning: Pydantic serializer warnings: PydanticSerializationUnexpectedValue: Expected `str` but got `list` with value `[TextPromptMessageContent...il=<DETAIL.LOW: 'low'>)]` - serialized value may not be as expected PydanticSerializationUnexpectedValue: Expected `PromptMessageContent` but got `TextPromptMessageContent` with value `TextPromptMessageContent(...'背诵一下这首诗')` - serialized value may not be as expected return self.__pydantic_serializer__.to_python( ``` The 4 providers are shown in the figure. ![Image](https://github.com/user-attachments/assets/924b32a4-6417-4659-8eef-d1cae8c96b75) The version of each plugin is as follows: - 火山方舟/volcengine_maas : 0.0.10 - OpenAI-API-compatible : 0.0.12 - 通义千问/tongyi : 0.0.16 - Azure OpenAI : 0.0.12
Author
Owner

@kurokobo commented on GitHub (Apr 10, 2025):

https://github.com/langgenius/dify/issues/17799#issuecomment-2794481200

@kurokobo commented on GitHub (Apr 10, 2025): https://github.com/langgenius/dify/issues/17799#issuecomment-2794481200
Author
Owner

@moshilangzi commented on GitHub (May 15, 2025):

langgenius/dify#17799 (comment)

In dify v1.4.0,the error occurs again:
use tongyi plugin: qwen2.5-vl-72b-instruct,upload 5 images ,then chat with model:
Run failed: [tongyi] Error: PluginInvokeError: {"args":null,"error_type":"PluginDaemonInnerError","message":"encountered an error: invalid character '\u003c' looking for beginning of value status: 502 Bad Gateway original response: \u003chtml\u003e"}

other plugins are the same error!

@moshilangzi commented on GitHub (May 15, 2025): > [langgenius/dify#17799 (comment)](https://github.com/langgenius/dify/issues/17799#issuecomment-2794481200) In dify v1.4.0,the error occurs again: use tongyi plugin: qwen2.5-vl-72b-instruct,upload 5 images ,then chat with model: Run failed: [tongyi] Error: PluginInvokeError: {"args":null,"error_type":"PluginDaemonInnerError","message":"encountered an error: invalid character '\u003c' looking for beginning of value status: 502 Bad Gateway original response: \u003chtml\u003e"} other plugins are the same error!
Author
Owner

@QuantumGhost commented on GitHub (May 15, 2025):

Hi @moshilangzi,

Thank you for your feedback! We're actively looking into this issue.

I also noticed that you've reported a similar issue in the Dify repository. To keep the discussion centralized and avoid duplication, I recommend continuing the conversation over there.

@QuantumGhost commented on GitHub (May 15, 2025): Hi @moshilangzi, Thank you for your feedback! We're actively looking into this issue. I also noticed that you've reported [a similar issue](https://github.com/langgenius/dify/issues/19796) in the Dify repository. To keep the discussion centralized and avoid duplication, I recommend continuing the conversation over there.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-official-plugins#169