mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-16 06:03:26 -05:00
[PR #24899] [CLOSED] [JAWA-1480] Fix NoneType startswith crash in get_event_emitter when chat_id is None #131582
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/24899
Author: @JawafdehiBot
Created: 5/19/2026
Status: ❌ Closed
Base:
main← Head:JAWA-1480-fix-chat-none-startswith📝 Commits (10+)
febbaf7fix: interpolate template vars in MCP connection headerse6ceefdadd deployment config for chat.jawafdehi.org5863705add persistent chat_logs volume to jawafdehi-mcp serviceb0ff02fci: add jawafdehi-custom branch to docker-build workflow triggersbd7c7f7Merge pull request #2 from Jawafdehi/jawafdehi-custom-ci-ghcre4f89deSimplify docker-build workflow to amd64-only builds1f05aaeAdd step to make GHCR package public for host pulls6e8a006Fix package visibility API endpoint to org-scopedeb0652cExport image as tar.gz artifact for offline deployc330e5aSwitch from GHCR to Docker Hub (public images, no auth needed for pull)📊 Changes
34 files changed (+8016 additions, -903 deletions)
View changed files
➕
.github/workflows/deploy-chat.yml(+63 -0)📝
.github/workflows/docker-build.yaml(+16 -881)📝
backend/open_webui/config.py(+12 -15)📝
backend/open_webui/env.py(+0 -2)📝
backend/open_webui/socket/main.py(+2 -2)📝
backend/open_webui/utils/middleware.py(+3 -3)➕
deploy/chat/.env.example(+12 -0)➕
deploy/chat/README.md(+124 -0)➕
deploy/chat/bin/bootstrap-config.sh(+237 -0)➕
deploy/chat/bin/deploy.sh(+88 -0)➕
deploy/chat/code/middleware.py(+5249 -0)➕
deploy/chat/code/tools_models.py(+303 -0)➕
deploy/chat/code/tools_utils.py(+1501 -0)➕
deploy/chat/configs/README.md(+41 -0)➕
deploy/chat/configs/knowledge/collections.json(+14 -0)➕
deploy/chat/configs/models/jawafdehi-caseworker.json(+29 -0)➕
deploy/chat/docker-compose.prod.yml(+86 -0)➕
deploy/chat/docker-compose.yml(+83 -0)➕
deploy/chat/mcp.env.example(+29 -0)➕
deploy/chat/nginx/chat.jawafdehi.org.conf(+36 -0)...and 14 more files
📄 Description
Root Cause
When chat.jawafdehi.org is called via API key (non-WebSocket session),
chat_idin metadata isNone. Inget_event_emitter(), the expressionrequest_info.get('chat_id', '')returnsNone(not the default empty string) because the key exists in the dict with valueNone. Calling.startswith()onNonecrashes with:This breaks ALL
/api/chat/completionsrequests via API key auth.Fix
Two lines in
backend/open_webui/socket/main.py:if (request_info.get('chat_id') or '').startswith('channel:')if update_db and message_id and not (request_info.get('chat_id') or '').startswith('local:')The
or ''pattern safely coalescesNoneto empty string.Verification
/api/chat/completionsreturns 200 with valid responses for all models (deepseek-v4-pro, kimi-k2.6)Links
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.