mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-16 06:03:26 -05:00
[PR #24814] [CLOSED] fix: guard chat_id NoneType in startswith calls #115175
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?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/24814
Author: @JawafdehiBot
Created: 5/16/2026
Status: ❌ Closed
Base:
dev← Head:fix/chat-id-startswith-none-JAWA-1197📝 Commits (1)
6249485fix: guard chat_id NoneType in startswith calls📊 Changes
1 file changed (+10 additions, -10 deletions)
View changed files
📝
backend/open_webui/utils/middleware.py(+10 -10)📄 Description
Description
Prevent
'NoneType' object has no attribute 'startswith'crashes whenmetadata['chat_id']is None in the chat middleware.In
backend/open_webui/utils/middleware.py, replaced all unsafemetadata['chat_id'].startswith(...)calls withmetadata.get('chat_id', '').startswith(...)across:background_tasks_handler(2 call sites:local:andchannel:)non_streaming_chat_response_handler(4 call sites forchannel:)streaming_chat_response_handler(4 call sites forchannel:)Linked Issue
No upstream issue linked — this is a defensive fix discovered during production deployment of Open WebUI. See /JAWA/issues/JAWA-1197 for internal tracking.
Paperclip-Run-Id: 631d3477-e895-44ae-8d4e-623796b39a20
Changelog Entry
Fixed
metadata['chat_id'].startswith()calls againstNonevalues in chat response and background task handlers to prevent AttributeError crashes whenchat_idis None.Contributor License Agreement
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.