Skip to content

I keep getting this error Response payload is not completed: <TransferEncodingError: 400, message='Not enough data to satisfy transfer length header.'>")> #564

@ndrew222

Description

@ndrew222

Yeah, I keep getting that error, and it takes a few regenerations. But it doesn't seem to count as an error on the API end.
I'm using Google Gemini API with the Gemini Pipeline.

Here's my logs. The weird thing is that the generation will begin to show on the WebUI but the error will be thrown in the logs. Then when I refresh, the generated text that managed to load disappears, and the error message is shown.

2025-09-11 14:01:08.125 | INFO     | uvicorn.protocols.http.httptools_impl:send:476 - 100.78.217.82:0 - "GET /api/v1/chats/?page=1 HTTP/1.1" 200
2025-09-11 14:01:08.329 | INFO     | uvicorn.protocols.http.httptools_impl:send:476 - 100.78.217.82:0 - "GET /api/v1/folders/ HTTP/1.1" 200
2025-09-11 14:01:09.341 | INFO     | uvicorn.protocols.http.httptools_impl:send:476 - 100.78.217.82:0 - "POST /api/chat/completions HTTP/1.1" 200
2025-09-11 14:01:09.519 | INFO     | open_webui.routers.openai:get_all_models:406 - get_all_models()
2025-09-11 14:01:09.894 | INFO     | uvicorn.protocols.http.httptools_impl:send:476 - 100.78.217.82:0 - "GET /api/v1/chats/?page=1 HTTP/1.1" 200
2025-09-11 14:01:10.538 | INFO     | uvicorn.protocols.http.httptools_impl:send:476 - 100.78.217.82:0 - "GET /api/v1/folders/ HTTP/1.1" 200
2025-09-11 14:01:16.293 | ERROR    | open_webui.tasks:cleanup_task:88 - Task exception was never retrieved
future: <Task finished name='Task-2350' coro=<chat_completion.<locals>.process_chat() done, defined at /app/backend/open_webui/main.py:1495> exception=HTTPException(status_code=400, detail="Response payload is not completed: <TransferEncodingError: 400, message='Not enough data to satisfy transfer length header.'>")>
Traceback (most recent call last):

  File "/usr/local/lib/python3.11/site-packages/aiohttp/client_proto.py", line 144, in connection_lost
    uncompleted = self._parser.feed_eof()
                  │    └ None
                  └ <aiohttp.client_proto.ResponseHandler object at 0x7f2ad62d60>
  File "aiohttp/_http_parser.pyx", line 508, in aiohttp._http_parser.HttpParser.feed_eof
    raise TransferEncodingError(
          └ <class 'aiohttp.http_exceptions.TransferEncodingError'>

aiohttp.http_exceptions.TransferEncodingError: 400, message:
  Not enough data to satisfy transfer length header.


The above exception was the direct cause of the following exception:


Traceback (most recent call last):

  File "/app/backend/open_webui/main.py", line 1514, in process_chat
    return await process_chat_response(
                 └ <function process_chat_response at 0x7f7c89f240>

  File "/app/backend/open_webui/utils/middleware.py", line 2636, in process_chat_response
    return await response_handler(response, events)
                 │                │         └ []
                 │                └ <starlette.responses.StreamingResponse object at 0x7f2ad5aa90>
                 └ <function process_chat_response.<locals>.response_handler at 0x7f2adc6200>

  File "/app/backend/open_webui/utils/middleware.py", line 2208, in response_handler
    await stream_body_handler(response, form_data)
          │                   │         └ {'stream': True, 'model': 'google_genai.gemini-2.5-pro-preview-05-06', 'messages': [{'role': 'system', 'content': '**I. Core ...
          │                   └ <starlette.responses.StreamingResponse object at 0x7f2ad5aa90>
          └ <function process_chat_response.<locals>.response_handler.<locals>.stream_body_handler at 0x7f2adc7920>

  File "/app/backend/open_webui/utils/middleware.py", line 1902, in stream_body_handler
    async for line in response.body_iterator:
              │       │        └ <StreamReader e=ClientPayloadError("Response payload is not completed: <TransferEncodingError: 400, message='Not enough data ...
              │       └ <starlette.responses.StreamingResponse object at 0x7f2ad5aa90>
              └ '\n'

  File "/usr/local/lib/python3.11/site-packages/aiohttp/streams.py", line 52, in __anext__
    rv = await self.read_func()
               │    └ <member 'read_func' of 'AsyncStreamIterator' objects>
               └ <aiohttp.streams.AsyncStreamIterator object at 0x7f5a5130a0>
  File "/usr/local/lib/python3.11/site-packages/aiohttp/streams.py", line 352, in readline
    return await self.readuntil()
                 │    └ <function StreamReader.readuntil at 0x7fae8cc040>
                 └ <StreamReader e=ClientPayloadError("Response payload is not completed: <TransferEncodingError: 400, message='Not enough data ...
  File "/usr/local/lib/python3.11/site-packages/aiohttp/streams.py", line 386, in readuntil
    await self._wait("readuntil")
          │    └ <function StreamReader._wait at 0x7fae8b3ec0>
          └ <StreamReader e=ClientPayloadError("Response payload is not completed: <TransferEncodingError: 400, message='Not enough data ...
  File "/usr/local/lib/python3.11/site-packages/aiohttp/streams.py", line 347, in _wait
    await waiter
          └ <Future finished exception=ClientPayloadError("Response payload is not completed: <TransferEncodingError: 400, message='Not e...

aiohttp.client_exceptions.ClientPayloadError: Response payload is not completed: <TransferEncodingError: 400, message='Not enough data to satisfy transfer length header.'>


During handling of the above exception, another exception occurred:


Traceback (most recent call last):

> File "/app/backend/open_webui/main.py", line 1541, in process_chat
    raise HTTPException(
          └ <class 'fastapi.exceptions.HTTPException'>

fastapi.exceptions.HTTPException: 400: Response payload is not completed: <TransferEncodingError: 400, message='Not enough data to satisfy transfer length header.'>
2025-09-11 14:01:53.119 | INFO     | uvicorn.protocols.http.httptools_impl:send:476 - 100.78.217.82:0 - "GET /_app/version.json HTTP/1.1" 304

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions