mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-16 05:47:50 -05:00
[GH-ISSUE #17135] issue: sending malformed "role": "tool" messages to OpenAI /v1/chat/completions endpoint #33710
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 @Lioscro on GitHub (Sep 1, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/17135
Check Existing Issues
Installation Method
Docker
Open WebUI Version
v0.6.26
Ollama Version (if applicable)
Metal llama.cpp v1.48.0 b6275 (via LM Studio)
Operating System
macOS Sequoia 15.6.1
Browser (if applicable)
No response
Confirmation
README.md.Expected Behavior
OpenWebUI calls the
/v1/chat/completionsOpenAI(-like) endpoint with tool calls with body that is compliant with the OpenAI schema (https://platform.openai.com/docs/api-reference/chat/create)Actual Behavior
When OpenWebUI POSTs the
/v1/chat/completionsendpoint, themessagesarray in the JSON body is malformed for tool calls ("role": "tool").Based on the OpenAI documentation, the
"content"key is required to be an array or a string, but OpenWebUI passes anull.Captured POST request to
/v1/chat/completionsOpenAI-like endpoint that is exposed via LM Studio:This results in LM Studio (and possibly other tools that enforce the schema) to reject the request. This shows up as tool calls "infinitely hanging." In other words, the OpenWebUI UI displays that the tool call was made and the call arguments, but it hangs forever and the actual request is never made. While the error itself is surfaced on LM Studio, and it is what rejects the request, I believe it is due to OpenWebUI passing a body that is not compliant with the OpenAI schema (linked above). Happy to raise this to LM Studio's team as well if that seems appropriate.
May be related to these other issues / discussions.
Note that this does not seem to be an issue with every tool call.
Steps to Reproduce
Difficult to provide a minimum example since the issue doesn't seem to occur with every tool call, but it does seem like if it happens for a specific tool call and model, it consistently happens without fail. My setup is the following.
qwen3-30b-a3b-instruct-2507-mlxhttps://huggingface.co/lmstudio-community/Qwen3-30B-A3B-Instruct-2507-MLX-6bit and tool calling set tonativegit-757e4ferunning withfirecrawl-mcpMCP. Note that due to this issue, the actual MCP server isn't even called, so you don't need to have a working firecrawl deployment working. In other words you can setFIRECRAWL_API_URLto anything.firecrawl_searchendpoint with a predefined query (e.g. Call thefirecrawl_searchendpoint with the query: Apple).Logs & Screenshots
Error in LM Studio due to malformed body
Other images are embedded inline in the previous sections.
Additional Information
No response
@Lioscro commented on GitHub (Sep 2, 2025):
Actually, looking into it a bit more, seems like something is causing OpenWebUI to not even call mcpo (verified by checking mcpo logs; usually there is a
Calling endpoint: ...entry, but none present whenever this issue happens), hence thenullcontent. Why OpenWebUI decides to skip calling the tool entirely is a mystery to me...Other tools work fine
And another model can call the
firecrawl_searchendpoint properly@Lioscro commented on GitHub (Sep 2, 2025):
Update: turns out the "infinite hanging" behavior was caused by the model taking my instruction to call
firecrawl_searchliterally (it should have beentool_firecrawl_search_post. Interesting that some models understood that I meanttool_firecrawl_search_postinstead and called the right endpoint.Would have been nice if OpenWebUI told me that it was trying to call a non-existent tool... (can we have this?) And perhaps even reply back to the model to tell it that the tool it tried to call doesn't exist so that it can attempt to fix itself...
In either case, the main point of this issue, OpenWebUI passing a schema-non-compliant body to the endpoint is still an issue.
@rgaricano commented on GitHub (Sep 2, 2025):
something like this: https://github.com/open-webui/open-webui/issues/16966#issuecomment-3229638997?
@tjbck commented on GitHub (Sep 2, 2025):
"content": nullshould be accepted by the model inference engine, @Lioscro are you able to reproduce the issue with openai models like gpt-4.1?@tan-yong-sheng commented on GitHub (Sep 2, 2025):
I am recently facing some kind of error with tool call as well, as discussed here. I can't detect the reason why it happens that time, and not sure if the comments above are the reason.
https://github.com/open-webui/open-webui/discussions/16278#discussioncomment-14267103
@tjbck commented on GitHub (Sep 3, 2025):
Should be addressed with
37bf0087e5