mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-16 14:39:31 -05:00
[GH-ISSUE #24575] bug: 'NoneType' object has no attribute 'startswith' on /api/chat/completions when external client omits parent_id #123654
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 @Ghosterme-dev on GitHub (May 11, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/24575
Check Existing Issues
Installation Method
Docker
Open WebUI Version
v0.9.5
Ollama Version (if applicable)
v0.23.2
Operating System
NVIDIA DGX Spark, DGX OS 7.5.0 (Ubuntu 24.04.4 LTS Noble Numbat, ARM64 / aarch64)
Browser (if applicable)
Not applicable
Confirmation
README.md.Expected Behavior
External OpenAI-compatible API clients (e.g. Nextcloud integration_openai app, plain curl) should be able to call /api/chat/completions with a minimal payload (without parent_id) and receive a valid chat response.
Actual Behavior
The request fails with HTTP 400 and the error:
{"detail": "'NoneType' object has no attribute 'startswith'"}The same custom model works fine when used via the Open WebUI browser interface.
Steps to Reproduce
Environment:
Set any name (e.g. nextcloud)
Set Base Model to an Ollama model (e.g. qwen3.6:35b)
Leave description empty
Generate an API key in Open WebUI (User Settings → API Keys)
Call the API from an external client without parent_id:
Expected result: HTTP 200 with chat response
Actual result: HTTP 400 'NoneType' object has no attribute 'startswith'
Verify the same model works in the browser UI → it does (HTTP 200).
Adding "stream": false does NOT fix the issue.
Logs & Screenshots
Root cause identified via source inspection of main.py:
is_new_chat is only set to True when parent_id is explicitly present in the request body and is None:
External API clients do not include parent_id → is_new_chat = False → metadata['chat_id'] stays None. When any exception occurs, the exception handler at ~line 2017 crashes:
This masks the original exception and returns a confusing 400 error to the caller.
Proposed fix:
BEFORE:
is_new_chat = 'parent_id' in form_data and form_data['parent_id'] is None and not form_data.get('chat_id')AFTER:
is_new_chat = not form_data.get('chat_id')Additional Information
docker-compose.yml (relevant excerpt):
@owui-terminator[bot] commented on GitHub (May 11, 2026):
🔍 Related Issues Found
I found some existing issues that might be related. Please check if any of these are duplicates or contain helpful solutions:
🟢 #24553 issue: /api/chat/completions runs into error
Same endpoint and same
'NoneType' object has no attribute 'startswith'failure on/api/chat/completionsin v0.9.5. It appears to be the same API regression, though this report is less specific about the missingparent_idcondition.by tweinberger-lei ·
bug🟣 #24564 bug: API calls to /api/chat/completions fail: "'NoneType' object has no attribute 'startswith'"
Direct match on the same error, endpoint, version range, and API-only failure. It reports
/api/chat/completionsreturning HTTP 400 with the exactstartswithexception, making it highly related.by da-astro ·
bug🟣 #24573 issue: External API returns 400 error with 'NoneType' object has no attribute 'startswith' since v0.9.3**
Same error and same external API symptom since v0.9.3, with a curl repro against
/api/chat/completions. This is closely related to the new issue’s external-client context and version regression.by choseongho11 ·
bug💡 If your issue is a duplicate, please close it and add any additional details to the existing issue instead.
This comment was generated automatically. React with 👍 if helpful, 👎 if not.