mirror of
https://github.com/open-webui/open-webui.git
synced 2026-08-23 18:02:25 -05:00
[GH-ISSUE #24265] issue: Image generation reports aiohttp ServerDisconnectedError as HTTP 400 #123558
Reference in New Issue
Block a user
Originally created by @belugaming on GitHub (Apr 30, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/24265
Check Existing Issues
Installation Method
Docker
Open WebUI Version
v0.9.2 (local checkout used for code inspection:
8dae237a0)Ollama Version (if applicable)
N/A - image generation uses an OpenAI-compatible endpoint, not Ollama
Operating System
Docker/Linux backend; host observed from local diagnosis on macOS
Browser (if applicable)
N/A - backend/tool-call failure
Confirmation
README.md.Expected Behavior
Transport-level failures from an OpenAI-compatible image generation endpoint, such as aiohttp.ServerDisconnectedError, ClientConnectionError, ClientPayloadError, or timeouts, should not be reported to the user as HTTP 400.
These should be surfaced as a gateway/upstream failure, for example 502 or 504, with diagnostic logging that includes the image generation engine, target API base URL host, model, elapsed time, exception type, and whether the failure happened during request, response read, or image upload.
Actual Behavior
When using the built-in generate_image tool with an OpenAI-compatible image generation endpoint, Open WebUI sometimes returns:
400: [ERROR: Server disconnected]
The underlying exception is aiohttp.ServerDisconnectedError('Server disconnected'). This appears to be a transport/upstream disconnect, but image_generations() catches the exception and wraps it as HTTP 400, making it look like a bad request or invalid image-generation parameter.
Steps to Reproduce
The corresponding OpenAI-compatible image request shape is:
The issue is not that this payload is always invalid. In local diagnostics, the same model/payload shape returned HTTP 200 with b64_json image data when sent directly with curl and with aiohttp==3.13.5. The confusing part is that an intermittent transport disconnect is surfaced as a user-facing HTTP 400.
Logs & Screenshots
Relevant stack trace:
Relevant code path:
The inner exception shown in the logs is:
Additional Information
This may be especially confusing with OpenAI-compatible proxy/CDN endpoints returning large chunked JSON responses containing b64_json image data. If the upstream has already generated the image and the connection drops while returning the response to Open WebUI, users may see a 400 even though the failure is not caused by invalid request parameters.
Possible improvement: