[PR #24813] [CLOSED] [JAWA-1197] Guard chat_id NoneType in startswith calls #131530

Closed
opened 2026-05-21 17:08:33 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/24813
Author: @JawafdehiBot
Created: 5/16/2026
Status: Closed

Base: mainHead: fix/chat-id-startswith-none-JAWA-1197


📝 Commits (1)

  • 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:)

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.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/24813 **Author:** [@JawafdehiBot](https://github.com/JawafdehiBot) **Created:** 5/16/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/chat-id-startswith-none-JAWA-1197` --- ### 📝 Commits (1) - [`6108178`](https://github.com/open-webui/open-webui/commit/6108178eefd484088c6fe3c2eed364e7fe1ab124) fix: guard chat_id NoneType in startswith calls ### 📊 Changes **1 file changed** (+10 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/utils/middleware.py` (+10 -10) </details> ### 📄 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:`) ## Related - Originating issue: [/JAWA/issues/JAWA-1197](/JAWA/issues/JAWA-1197) - Paperclip-Run-Id: 631d3477-e895-44ae-8d4e-623796b39a20 ## Rollback Revert this commit or apply the inverse diff to restore previous behaviour. No migration or config changes needed. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-21 17:08:33 -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#131530