[GH-ISSUE #11750] issue: The pipe function reports an error when calling __event_emitter__ #55010

Closed
opened 2026-05-05 17:01:30 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @wangyufeng-empty on GitHub (Mar 17, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/11750

Check Existing Issues

  • I have searched the existing issues and discussions.
  • I am using the latest version of Open WebUI.

Installation Method

Pip Install

Open WebUI Version

0.5.19

Ollama Version (if applicable)

No response

Operating System

ManjaroLinux

Browser (if applicable)

Chrome

Confirmation

  • I have read and followed all instructions in README.md.
  • I am using the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs.
  • I have included the Docker container logs.
  • I have listed steps to reproduce the bug in detail.

Expected Behavior

BUG Report
Description: While using the site package in the open_webui module, the following error occurred:

ERROR | open_webui.functions:stream_content:280 - Error: 'NoneType' object has no attribute 'get' - {}
Code Information:

File Path: Anaconda3\envs\pipeline\Lib\site-packages\open_webui\socket\main.py
Function Location: Line 296
Function Code:

if "type" in event_data and event_data["type"] == "message":
message = Chats.get_message_by_id_and_message_id(
request_info["chat_id"],
request_info["message_id"],
)

content = message.get("content", "")
content += event_data.get("data", {}).get("content", "")

Calling Flow:

Initialization Code:

async def pipe(
self, body: dict, event_emitter: Callabledict], Awaitable[None = None
):
self.current_event_emitter = event_emitter
# ...

Calling Code:
async def emit_message(self, message: str):
await self.current_event_emitter(
{"type": "message", "data": {"content": message}}
)

await self.llm.emit_message("Thinking:\n ")
Error Description:

When running on the server, the application throws the error: 'NoneType' object has no attribute 'get'. This error occurs in the line message.get("content", ""), indicating that the Chats.get_message_by_id_and_message_id function returned None, causing a None value for message and failing when .get() is called.

Steps to Reproduce:

Call the emit_message method with a message.
Trigger the get_message_by_id_and_message_id function, which fails to find the message and returns None.
The error happens when trying to access message.get("content", "").

Actual Behavior

When the emit_message method is called (e.g., with the string "Thinking:\n "), the server logs an error:

ERROR | open_webui.functions:stream_content:280 - Error: 'NoneType' object has no attribute 'get' - {}
This indicates that the function Chats.get_message_by_id_and_message_id returned None instead of a valid message object. Consequently, when the code attempts to execute message.get("content", ""), it fails because None does not have a get method, and the error disrupts the intended message processing flow.

Steps to Reproduce

Set Up Environment:
Ensure you are using the Anaconda3\envs\pipeline environment with the open_webui module installed.

Locate the Code:
Open the file at Anaconda3\envs\pipeline\Lib\site-packages\open_webui\socket\main.py and navigate to line 296 where the error occurs.

Initialize the Pipeline:
Call the pipe function with a valid body dictionary and provide an event emitter function via the event_emitter parameter.

async def pipe(self, body: dict, event_emitter: Callabledict], Awaitable[None = None):
self.current_event_emitter = event_emitter
# ...
Invoke the Emit Message Function:
From your code, call the emit_message function with a message string, for example:

async def emit_message(self, message: str):
await self.current_event_emitter(
{"type": "message", "data": {"content": message}}
)

await self.llm.emit_message("Thinking:\n ")
Trigger Message Processing:
The event emitter sends the message to the module, triggering the block of code in open_webui\socket\main.py which calls:

message = Chats.get_message_by_id_and_message_id(
request_info["chat_id"],
request_info["message_id"],
)
content = message.get("content", "")
content += event_data.get("data", {}).get("content", "")
Observe the Error:
Since Chats.get_message_by_id_and_message_id returns None (because it cannot find the specified message), attempting to call .get("content", "") on a NoneType results in the following error:

ERROR | open_webui.functions:stream_content:280 - Error: 'NoneType' object has no attribute 'get' - {}
Following these steps should consistently reproduce the error.

Logs & Screenshots

2025-03-17 10:40:09,725 - function_基于蒙特卡洛搜索树的迭代式检索增强 - DEBUG - 开始执行 MCTS 算法...
2025-03-17 10:40:09,725 - function_基于蒙特卡洛搜索树的迭代式检索增强 - DEBUG - 正在进行default_max_iterations迭代: 1/2...
2025-03-17 10:40:09,725 - function_基于蒙特卡洛搜索树的迭代式检索增强 - DEBUG - 开始搜索...
2025-03-17 10:40:09,725 - function_基于蒙特卡洛搜索树的迭代式检索增强 - DEBUG - 正在选择节点...
2025-03-17 10:40:09,725 - function_基于蒙特卡洛搜索树的迭代式检索增强 - DEBUG - 正在对节点 8ff4d 进行扩展...
2025-03-17 10:40:09,725 - function_基于蒙特卡洛搜索树的迭代式检索增强 - DEBUG - 正在处理: 正在对节点 8ff4d 进行深度思考...
2025-03-17 10:40:09,729 - function_基于蒙特卡洛搜索树的迭代式检索增强 - DEBUG - 思考...
2025-03-17 10:40:09.731 | ERROR | open_webui.functions:stream_content:280 - Error: 'NoneType' object has no attribute 'get' - {}
2025-03-17 10:40:09.760 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 172.18.103.88:59182 - "POST /api/chat/completed HTTP/1.1" 200 - {}

Image

Additional Information

Image

Image

Image

Image

Image

Originally created by @wangyufeng-empty on GitHub (Mar 17, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/11750 ### Check Existing Issues - [x] I have searched the existing issues and discussions. - [x] I am using the latest version of Open WebUI. ### Installation Method Pip Install ### Open WebUI Version 0.5.19 ### Ollama Version (if applicable) _No response_ ### Operating System ManjaroLinux ### Browser (if applicable) Chrome ### Confirmation - [x] I have read and followed all instructions in `README.md`. - [x] I am using the latest version of **both** Open WebUI and Ollama. - [x] I have included the browser console logs. - [x] I have included the Docker container logs. - [x] I have listed steps to reproduce the bug in detail. ### Expected Behavior BUG Report Description: While using the site package in the open_webui module, the following error occurred: ERROR | open_webui.functions:stream_content:280 - Error: 'NoneType' object has no attribute 'get' - {} Code Information: File Path: Anaconda3\envs\pipeline\Lib\site-packages\open_webui\socket\main.py Function Location: Line 296 Function Code: if "type" in event_data and event_data["type"] == "message": message = Chats.get_message_by_id_and_message_id( request_info["chat_id"], request_info["message_id"], ) content = message.get("content", "") content += event_data.get("data", {}).get("content", "") Calling Flow: Initialization Code: async def pipe( self, body: dict, __event_emitter__: Callable[[dict], Awaitable[None]] = None ): self.__current_event_emitter__ = __event_emitter__ # ... Calling Code: async def emit_message(self, message: str): await self.__current_event_emitter__( {"type": "message", "data": {"content": message}} ) await self.llm.emit_message("Thinking:\n ") Error Description: When running on the server, the application throws the error: 'NoneType' object has no attribute 'get'. This error occurs in the line message.get("content", ""), indicating that the Chats.get_message_by_id_and_message_id function returned None, causing a None value for message and failing when .get() is called. Steps to Reproduce: Call the emit_message method with a message. Trigger the get_message_by_id_and_message_id function, which fails to find the message and returns None. The error happens when trying to access message.get("content", ""). ### Actual Behavior When the emit_message method is called (e.g., with the string "Thinking:\n "), the server logs an error: ERROR | open_webui.functions:stream_content:280 - Error: 'NoneType' object has no attribute 'get' - {} This indicates that the function Chats.get_message_by_id_and_message_id returned None instead of a valid message object. Consequently, when the code attempts to execute message.get("content", ""), it fails because None does not have a get method, and the error disrupts the intended message processing flow. ### Steps to Reproduce Set Up Environment: Ensure you are using the Anaconda3\envs\pipeline environment with the open_webui module installed. Locate the Code: Open the file at Anaconda3\envs\pipeline\Lib\site-packages\open_webui\socket\main.py and navigate to line 296 where the error occurs. Initialize the Pipeline: Call the pipe function with a valid body dictionary and provide an event emitter function via the __event_emitter__ parameter. async def pipe(self, body: dict, __event_emitter__: Callable[[dict], Awaitable[None]] = None): self.__current_event_emitter__ = __event_emitter__ # ... Invoke the Emit Message Function: From your code, call the emit_message function with a message string, for example: async def emit_message(self, message: str): await self.__current_event_emitter__( {"type": "message", "data": {"content": message}} ) await self.llm.emit_message("Thinking:\n ") Trigger Message Processing: The event emitter sends the message to the module, triggering the block of code in open_webui\socket\main.py which calls: message = Chats.get_message_by_id_and_message_id( request_info["chat_id"], request_info["message_id"], ) content = message.get("content", "") content += event_data.get("data", {}).get("content", "") Observe the Error: Since Chats.get_message_by_id_and_message_id returns None (because it cannot find the specified message), attempting to call .get("content", "") on a NoneType results in the following error: ERROR | open_webui.functions:stream_content:280 - Error: 'NoneType' object has no attribute 'get' - {} Following these steps should consistently reproduce the error. ### Logs & Screenshots 2025-03-17 10:40:09,725 - function_基于蒙特卡洛搜索树的迭代式检索增强 - DEBUG - 开始执行 MCTS 算法... 2025-03-17 10:40:09,725 - function_基于蒙特卡洛搜索树的迭代式检索增强 - DEBUG - 正在进行default_max_iterations迭代: 1/2... 2025-03-17 10:40:09,725 - function_基于蒙特卡洛搜索树的迭代式检索增强 - DEBUG - 开始搜索... 2025-03-17 10:40:09,725 - function_基于蒙特卡洛搜索树的迭代式检索增强 - DEBUG - 正在选择节点... 2025-03-17 10:40:09,725 - function_基于蒙特卡洛搜索树的迭代式检索增强 - DEBUG - 正在对节点 8ff4d 进行扩展... 2025-03-17 10:40:09,725 - function_基于蒙特卡洛搜索树的迭代式检索增强 - DEBUG - 正在处理: 正在对节点 8ff4d 进行深度思考... 2025-03-17 10:40:09,729 - function_基于蒙特卡洛搜索树的迭代式检索增强 - DEBUG - 思考... 2025-03-17 10:40:09.731 | ERROR | open_webui.functions:stream_content:280 - Error: 'NoneType' object has no attribute 'get' - {} 2025-03-17 10:40:09.760 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 172.18.103.88:59182 - "POST /api/chat/completed HTTP/1.1" 200 - {} ![Image](https://github.com/user-attachments/assets/1c79a844-5033-4e32-ac99-9e904b5d6b3c) ### Additional Information ![Image](https://github.com/user-attachments/assets/430001c9-49ad-4a22-9174-bf9dfba179c6) ![Image](https://github.com/user-attachments/assets/861cfe53-00c9-43b2-9ec7-de01bea07b06) ![Image](https://github.com/user-attachments/assets/d7b9e1e6-fb7f-4512-9d45-2d95be2918ee) ![Image](https://github.com/user-attachments/assets/26a29234-3d9d-45dc-87fc-70d8313abf84) ![Image](https://github.com/user-attachments/assets/7f84245a-1e80-47f8-92b0-b7623fddba5b)
GiteaMirror added the bug label 2026-05-05 17:01:30 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#55010