6108178 fix: 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
Summary
Prevent 'NoneType' object has no attribute 'startswith' crashes when metadata['chat_id'] is None.
Changes
In backend/open_webui/utils/middleware.py, replaced all 10 occurrences of metadata['chat_id'].startswith(...) with metadata.get('chat_id', '').startswith(...) across:
background_tasks_handler (1 call site for channel:, 1 for local:)
non_streaming_chat_response_handler (4 call sites for channel:)
streaming_chat_response_handler (4 call sites for channel:)
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/24813
Author: @JawafdehiBot
Created: 5/16/2026
Status: ❌ Closed
Base:
main← Head:fix/chat-id-startswith-none-JAWA-1197📝 Commits (1)
6108178fix: 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
Summary
Prevent
'NoneType' object has no attribute 'startswith'crashes whenmetadata['chat_id']is None.Changes
In
backend/open_webui/utils/middleware.py, replaced all 10 occurrences ofmetadata['chat_id'].startswith(...)withmetadata.get('chat_id', '').startswith(...)across:background_tasks_handler(1 call site forchannel:, 1 forlocal:)non_streaming_chat_response_handler(4 call sites forchannel:)streaming_chat_response_handler(4 call sites forchannel:)Related
Rollback
Revert this commit or apply the inverse diff to restore previous behaviour. No migration or config changes needed.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.