mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-16 14:39:31 -05:00
issue: "Chunk too big" error when using Google Gemini 2.5 Flash with image input #6460
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 @BND-1 on GitHub (Sep 21, 2025).
Check Existing Issues
Installation Method
Docker
Open WebUI Version
v0.6.30
Ollama Version (if applicable)
No response
Operating System
centos
Browser (if applicable)
chrome
Confirmation
README.md.Expected Behavior
When using the Google: Gemini 2.5 Flash Image Preview model, sending a prompt that includes an image results in a "Chunk too big" error in the user interface. This prevents the model from processing the request and providing a response.
Actual Behavior
The request fails, and a red error box appears in the chat interface with the message: Chunk too big.
Steps to Reproduce
1.Navigate to the OpenWebUI chat interface.
2.Select Google: Gemini 2.5 Flash Image Preview from the model selection dropdown.
3.Upload an image or provide an image along with a text prompt (e.g., "draw a puppy").
4.Send the message to the model.
5.Observe the error message displayed in the chat window.
Logs & Screenshots
Additional Information
This error suggests a potential issue with how large inputs, specifically image data, are chunked or sent to the backend/model API. It seems to be hitting a size limit somewhere in the data transmission pipeline. This issue currently blocks the use of the vision capabilities for the Gemini 2.5 Flash model within OpenWebUI.
@yborunov commented on GitHub (Sep 26, 2025):
same issue. Any update?
@cj1324 commented on GitHub (Sep 26, 2025):
same issue. Any update?
@ShirasawaSama commented on GitHub (Sep 26, 2025):
We previously discovered that when SSE single-line data is extremely large (likely exceeding 16KB), directly using Python's asynchronous iterator to traverse aiohttp's
response.contentforces the use of aiohttp's built-in buffer size, which cannot be configured.https://github.com/open-webui/open-webui/blob/main/backend/open_webui/routers/openai.py#L947
Our solution was to replace it with our own asynchronous iterator, calling AsyncContentStream's
iter_chunks()method to iterate over all bytes. We actively split each line using the\nsymbol and then yield the data for each line.This approach avoids the constraints of aiohttp's buffer size. Unfortunately, I don't have permission to publish this specific code, so I can only share the underlying solution concept.
cc @tjbck
@OakerO commented on GitHub (Sep 29, 2025):
Maybe someone should publish it then?
@rgaricano commented on GitHub (Sep 29, 2025):
approach, for
37d1c85c99/backend/open_webui/routers/openai.py (L929-L977)By using iter_chunked() or iter_any(), we avoid this line-buffering behavior and process data in smaller, manageable chunks regardless of line boundaries.
We can choose iter_any() for immediate data availability or iter_chunked() with a specific chunk size (like 8192 bytes) for more predictable memory usage.
@ShirasawaSama commented on GitHub (Sep 29, 2025):
@rgaricano
In fact, many of my MCP SSE calls exceed 500KB, and occasionally even surpass 50MB per line. Consequently, my code includes logic to skip lines exceeding a certain length.
However, I don't think this is a common scenario, so it may not necessarily need to be implemented.
Additionally, we cannot directly call
iter_anyoriter_chunkedand then yield the chunk directly; this approach is incorrect.Because a single chunk may contain multiple lines, or a single line may be split across multiple chunks. Therefore, we must concatenate multiple chunks and use the
\ncharacter to separate lines of text. If the current chunk's terminator is not a\ncharacter, we can assume that the next chunk or subsequent chunks still contain the remainder of the current line.@rgaricano commented on GitHub (Sep 29, 2025):
then maybe something like this:
@ddddavid-he commented on GitHub (Oct 8, 2025):
Any update?
@ShirasawaSama commented on GitHub (Oct 11, 2025):
Any update? 🤔
@COCONUTwwater commented on GitHub (Oct 17, 2025):
Any update? 🤔
@Classic298 commented on GitHub (Oct 17, 2025):
PR welcome afaik
@GeoffreyLng commented on GitHub (Oct 21, 2025):
Same issue, any updates ?
@pixma140 commented on GitHub (Oct 21, 2025):
Having the same issue with the GPT-5 Image model. Just added OpenRouter and my API Key in my Open WebUI UI and experiencing the same issue. Sometimes I get back a little bit of text like: "Here you go! A corgi in space, in XYZ-style!" and then the red error message pops up.
@Classic298 commented on GitHub (Oct 21, 2025):
No update yet, PR welcome
@mweichert commented on GitHub (Oct 25, 2025):
Also experiencing this issue with
gemini-2.5-flash-lite.@NopeNix commented on GitHub (Oct 30, 2025):
same here
@zuogod commented on GitHub (Nov 3, 2025):
Any update? 🤔
@Classic298 commented on GitHub (Nov 3, 2025):
PR welcome
@ShirasawaSama commented on GitHub (Nov 3, 2025):
#18884
@silentoplayz commented on GitHub (Nov 5, 2025):
Related - https://github.com/open-webui/open-webui/issues/16935
@Classic298 commented on GitHub (Nov 6, 2025):
should be fixed in dev
@ShirasawaSama commented on GitHub (Nov 7, 2025):
@Classic298 Not yet resolved
@ddddavid-he commented on GitHub (Nov 7, 2025):
Same situation on my machine
@DeusMaximus commented on GitHub (Nov 7, 2025):
Still happening through LiteLLM
@GeoffreyLng commented on GitHub (Nov 7, 2025):
Still occuring when using LiteLLM
@ddkedr commented on GitHub (Nov 7, 2025):
@Classic298 can we reopen it? Still does not work when using LiteLLM
@Classic298 commented on GitHub (Nov 7, 2025):
I am aware, but that is as it looks to me, an issue with LiteLLM. I raised it with them, hopefully they can address it soon.
(Add Gemini 2.5 Flash Image in the Image configs)
@AlexZorzi commented on GitHub (Nov 7, 2025):
@Classic298 for me its not working either, im not using LiteLLM, connected directly to OpenRouter.
@Classic298 commented on GitHub (Nov 7, 2025):
Do not talk to the model - add it in the image config as I said. - and not sure openrouter is supported yet, but the official Gemini API is supported.
@ShirasawaSama commented on GitHub (Nov 10, 2025):
Hey everyone, the “Chunk too big” issue has been fixed in the latest dev branch.
You can enable it using the following environment variable:
And the issue where models in OpenRouter cannot output images will be fixed in this pull request #19073.
@tjbck commented on GitHub (Nov 10, 2025):
@silentoplayz @Classic298 Documentation updated wanted here!
@silentoplayz commented on GitHub (Nov 10, 2025):
What is enabled when I set this as an environment variable for my Open WebUI instance? Is it necessary to have this environment variable set at all for image generation/editing to work properly using Google Gemini 2.5 Flash in Open WebUI?
@ShirasawaSama commented on GitHub (Nov 10, 2025):
Related PR #19076
@ShirasawaSama commented on GitHub (Nov 10, 2025):
This value is recommended to be greater than 5MB. As a reference, a GPT image typically outputs around 3.5MB of Base64-encoded image data. Our production environment is configured to 8MB (since we implemented sending socket.io data via SSE, which prevents massive single-line data from causing Redis cluster crashes; therefore, I do not recommend setting this value too high).
A value greater than 2.5MB must be set to display images generated by the nano banana model.
@Classic298 commented on GitHub (Nov 10, 2025):
documted
@usef814 commented on GitHub (Nov 11, 2025):
This will be great, I have been having the same issue ("Chunk too big") between openwebui and openrouter when trying to generate an image. . In the meantime using the integration with comfyui, works ok but text just isn't great when compared to gpt-5 image or many others.
@Dzenn00 commented on GitHub (Nov 11, 2025):
Hi, we used the specified variable, but we get this output without a picture. Most often, the model simply sends ` symbol
@M0n7y5 commented on GitHub (Nov 11, 2025):
CHAT_STREAM_RESPONSE_CHUNK_MAX_BUFFER_SIZE
does not help at all, i tested nano banana and chatgpt 5 image, still chunk too big error
@Classic298 commented on GitHub (Nov 11, 2025):
@M0n7y5 that env var doesn't exist yet.
It was just introduced on the dev branch and will be shipped in the next version