mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-23 01:51:58 -05:00
[GH-ISSUE #24550] bug: NoneType object has no attribute 'startswith' — all /api/v1/chat/completions calls return 400 (v0.9.5, direct connections) #91067
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?
Originally created by @ThefloorMiner on GitHub (May 10, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/24550
Bug Description
All chat completion API calls from external clients (CLI tools, IDE extensions, scripts) return HTTP 400 with
{"detail": "'NoneType' object has no attribute 'startswith'"}in OpenWebUI 0.9.5.The issue affects every configured model and every external API client tested (OpenClaude CLI, VS Code AI extensions).
Environment
ghcr.io/open-webui/open-webui:latest)OLLAMA_BASE_URLS: [],OPENAI_API_BASE_URLS: [],direct.enable: true)functiontable)Bearer sk-...)Steps to Reproduce
Actual Behavior
HTTP 400:
Server log (
docker logs):Expected Behavior
HTTP 200 with a streamed or complete chat response — same as what the web UI receives.
Analysis
The error is logged at line 2013 of
main.py:error_detail = str(e)is'NoneType' object has no attribute 'startswith'— the original exception is astr.startswith()call onNonesomewhere in thetryblock ofprocess_chat.The crash likely originates in the routing/forwarding stack (model dispatch, pipeline resolution, or direct-connection handling) when a model field or URL is
None— a code path only reached whenchat_id,parent_id, andsession_idare absent (i.e. external API clients).Additional Notes
/api/v1/modelsworks correctly and returns the model liststr(e)is captured, which makes root-cause analysis harderSuggested Improvement
Logging the full traceback in the exception handler would make root-cause analysis much easier:
@owui-terminator[bot] commented on GitHub (May 10, 2026):
⚠️ Missing Issue Title Prefix
@ThefloorMiner, your issue title is missing a categorising prefix (e.g.
bug:,feat:,docs:).Please update the title to lead with one of:
Example:
bug: Login fails when the password contains special characters@Classic298 commented on GitHub (May 10, 2026):
Cannot reproduce
@Classic298 commented on GitHub (May 10, 2026):
latest
@xcjs commented on GitHub (May 10, 2026):
I've reproduced this in my environment as well - it's not the web frontend in which this is broken.
@cslev commented on GitHub (May 11, 2026):
I have the same problem. Open Web UI works well in the browser, but sending a cURL request to be processed it requires a random "chat_id" in the POST content, because this is how it identifies with chat window to respond to. But via cURL or actually integrating it into copilot or any app, there is no such thing as "chat_id". I could resolve the issue in cURL as I can add that random chat_id, but OAI compatible copilot providers or the python API does not have this.
So, this works:
Without the
chat_id, it does not. I was thinking that there might be an API-endpoint via/v1/somewhere, but didn't find any. I found though that accessing models have two URLs (which looked promising in the beginning):So this was working:
just as well as:
But for
api/chat/completitionsthere is no similarapi/v1/chat/completions.... I mean there is, it works, but only with the "chat_id" also set.@Classic298 commented on GitHub (May 11, 2026):
see https://github.com/open-webui/open-webui/issues/24553
@sastrax commented on GitHub (May 12, 2026):
Reproducer from a different angle (UI path, OWUI 0.9.5, LiteLLM backend, SQLite)
I can reproduce a closely related variant of this bug in OWUI 0.9.5 from the web UI, not just from external API clients. Posting in case it helps re-open the investigation.
Setup:
ghcr.io/open-webui/open-webui:v0.9.5, fresh deploy (no migrated 0.8.12 DB)direct.enable: false,auth.enable_api_keys: false— no direct connectionsgpt-5(OpenAI o-series, reasoning model), routed via LiteLLMReproducer:
gpt-5(or any o-series reasoning model)"Is 9.11 or 9.9 greater? Think step by step.")claude-sonnet-4-6(or any non-reasoning model) and send another prompt'NoneType' object has no attribute 'startswith'— HTTP 400 from/api/chat/completionsServer log:
LiteLLM log shows the reasoning request was successful (200 OK) — so the upstream backend behaves correctly. The issue appears to be that the failed UI render in step 4 persists the assistant message with a
None-valued field (probablychat_idormessage_idon the persisted message), and the follow-up call (step 6) then trips over it insideprocess_chat.Once the chat is in this state, every subsequent send in the same chat hits the same crash regardless of model. New chats are fine until the next reasoning request.
Workaround: delete the corrupted chat and avoid reasoning models on this version. Looks like two coupled bugs: the reasoning-stream UI render path, and the chat_id-None handling in
process_chat:2013.Happy to provide more logs or screenshots if useful.
Kind regards
Fabian
@kevinchappell commented on GitHub (May 12, 2026):
I reproduced this by connecting to open webui api from opencode. #24556 fixed it for me
@thexavier666 commented on GitHub (May 15, 2026):
@cslev I was having the same issue as mentioned in this thread. I am using Python and I just modified my request to include
chat_id. This fixed my issue. Thanks.