-
-
Notifications
You must be signed in to change notification settings - Fork 17.9k
Description
Check Existing Issues
- I have searched for any existing and/or related issues.
- I have searched for any existing and/or related discussions.
- I have also searched in the CLOSED issues AND CLOSED discussions and found no related items (your issue might already be addressed on the development branch!).
- I am using the latest version of Open WebUI.
Installation Method
Git Clone
Open WebUI Version
v0.7.2
Ollama Version (if applicable)
0.13.5
Operating System
Debian, Windows
Browser (if applicable)
N/A
Confirmation
- I have read and followed all instructions in
README.md. - I am using the latest version of both Open WebUI and Ollama.
- I have included the browser console logs.
- I have included the Docker container logs.
- I have provided every relevant configuration, setting, and environment variable used in my setup.
- I have clearly listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc).
- I have documented step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation. My steps:
- Start with the initial platform/version/OS and dependencies used,
- Specify exact install/launch/configure commands,
- List URLs visited, user input (incl. example values/emails/passwords if needed),
- Describe all options and toggles enabled or changed,
- Include any files or environmental changes,
- Identify the expected and actual result at each stage,
- Ensure any reasonably skilled user can follow and hit the same issue.
Expected Behavior
Messages sent to the LLM should contain clean, properly formatted JSON without HTML entities:
- Tool results should use standard JSON escaping:
\" - No HTML entities like
",&,'should be present in the message content sent to LLM - The model should receive the same clean format whether it's the first turn or subsequent turns
Actual Behavior
In multi-turn conversations with tool calls:
- Messages retrieved from the database contain HTML-escaped JSON
- The frontend's
processDetails()function inserts HTML-escaped content directly into messages - Messages sent to the LLM contain
"entities instead of proper quotes - The model receives malformed, hard-to-parse content
Steps to Reproduce
- Start a new chat conversation in Open WebUI
- Send a message that triggers a custom tool call (e.g., "Give me extremely brief summary of today's top 2 news. Use the tool available.")
- Wait for the tool call to complete and the assistant to respond
- Send a follow-up message (e.g., "make it even shorter")
- Inspect the messages sent to the LLM (requires debug logging):
- The assistant's message from step/turn 2 will contain HTML-escaped JSON:
""{\\n \\"results\\": ...instead of clean JSON:"{\\n \\"results\\": ...
- The assistant's message from step/turn 2 will contain HTML-escaped JSON:
Logs & Screenshots
FIRST TURN (all good):
ollama[3261823]: time=2026-01-12T00:00:56.125Z level=TRACE source=server.go:1466 msg="completion request" prompt="<|im_start|>system\n### Task:\nRespond to the user query using the provided context, incorporating inline citations in the format [id] **only when the <source> tag includes an explicit id attribute** (e.g., <source id=\"1\">).\n\n### Guidelines:\n- If you don't know the answer, clearly state that.\n- If uncertain, ask the user for clarification.\n- Respond in the same language as the user's query.\n- If the context is unreadable or of poor quality, inform the user and provide the best possible answer.\n- If the answer isn't present in the context but you possess the knowledge, explain this to the user and provide the answer using your own understanding.\n- **Only include inline citations using [id] (e.g., [1], [2]) when the <source> tag includes an id attribute.**\n- Do not cite if the <source> tag does not contain an id attribute.\n- Do not use XML tags in your response.\n- Ensure citations are concise and directly related to the information provided.\n\n### Example of Citation:\nIf the user asks about a specific topic and the information is found in a source with a provided id attribute, the response should include the citation like in the following example:\n* \"According to the study, the proposed method increases efficiency by 20% [1].\"\n\n### Output:\nProvide a clear and direct response to the user's query, including inline citations in the format [id] only when the <source> tag with id attribute is present in the context.\n\n<context>\n<source id=\"1\" name=\"search_web\">{\n \"results\": [\n {\n \"type\": \"web\",\n \"title\": \"Reuters World News | Latest Top Stories | Reuters\",\n \"age\": \"\",\n \"description\": \"A group of European countries, led by Britain and Germany, is discussing plans to boost their military presence in Greenland to show U.S. President Donald Trump that the continent is serious about Arctic security, Bloomberg News reported on Sunday.\",\n \"url\": \"https://www.reuters.com/world/\"\n },\n {\n \"type\": \"web\",\n \"title\": \"UK News - The latest headlines from the UK | Sky News\",\n \"age\": \"\",\n \"description\": \"'I have PTSD from online video': The growing call to ban smartphones in schools\",\n \"url\": \"https://news.sky.com/uk\"\n },\n {\n \"type\": \"web\",\n \"title\": \"Latest news from around the world | The Guardian\",\n \"age\": \"\",\n \"description\": \"Case brought by Muslim leaders and MP follows failed 2024 bid and seen as part of global anti-women’s rights backlash\",\n \"url\": \"https://www.theguardian.com/world\"\n },\n {\n \"type\": \"web\",\n \"title\": \"Breaking News, Latest News and Videos | CNN\",\n \"age\": \"\",\n \"description\": \"RFK Jr.’s new food pyramid puts meat, dairy at the top.\",\n \"url\": \"https://www.cnn.com/\"\n },\n {\n \"type\": \"web\",\n \"title\": \"World News - Breaking international news and headlines | Sky News\",\n \"age\": \"\",\n \"description\": \"There's a daily game of cat and mouse to catch illegal migrants in Germany - and it may soon become UK's problem\",\n \"url\": \"https://news.sky.com/world\"\n },\n {\n \"type\": \"web\",\n \"title\": \"UK | Latest News & Updates | BBC News\",\n \"age\": \"\",\n \"description\": \"Updates from your News topics will appear in My News and in a collection on the News homepage. I never saw young women on Epstein visits, Mandelson tells BBC · In his first interview since being sacked as the UK's US ambassador, Lord Mandelson also says he does not believe Donald Trump will take Greenland by force. ... Watch: Backlash against Musk's Grok AI explained. Video, 00:01:10Watch: Backlash against Musk's Grok AI explained ... Watch: Rowers capture close encounter with whales. Video, 00:00:25Watch: Rowers capture close encounter with whales\",\n \"url\": \"https://www.bbc.co.uk/news/uk\"\n },\n {\n \"type\": \"web\",\n \"title\": \"ABC News - Breaking News, Latest News and Videos\",\n \"age\": \"\",\n \"description\": \"The strikes come in retaliation for an attack that killed three Americans.\",\n \"url\": \"https://abcnews.go.com/\"\n },\n {\n \"type\": \"web\",\n \"title\": \"England | Latest News & Updates | BBC News\",\n \"age\": \"\",\n \"description\": \"Updates from your News topics will appear in My News and in a collection on the News homepage. 'I have 45 children applying to my special school each week' Head teacher Steph Smith says her school is oversubscribed and that more like it are needed. ... Man spotted skiing down residential street. Video, 00:00:16Man spotted skiing down residential street ... 0:45Prince Naseem actor on playing his hero. 00:00:45, play videoPrince Naseem actor on playing his hero · 0:28Cyclists get snow on their spokes in chilly ride.\",\n \"url\": \"https://www.bbc.co.uk/news/england\"\n },\n {\n \"type\": \"videos\",\n \"description\": \"Video. Catch up with the most important stories from around Europe and beyond - latest news, breaking news, World, Business, Entertainment, Politics, Culture, Travel.\",\n \"url\": \"https://www.euronews.com/video/2025/05/29/latest-news-bulletin-may-29th-evening\"\n },\n {\n \"type\": \"videos\",\n \"description\": \"President Donald Trump will receive an intelligence briefing today at 11 AM ET in the Oval Office. Trump will has lunch with Vice President JD Vance and then...\",\n \"url\": \"https://www.youtube.com/watch?v=rr014mxX1sg\"\n },\n {\n \"type\": \"videos\",\n \"description\": \"Get today's top stories, breaking news and original reporting on CBS News 24/7.#news #livenews #breakingnews CBS News 24/7 is the premier anchored streaming ...\",\n \"url\": \"https://www.youtube.com/watch?v=Jr0VVkRUqE4\"\n },\n {\n \"type\": \"videos\",\n \"description\": \"Video. Catch up with the most important stories from around Europe and beyond this January 4th, 2026 - latest news, breaking news, World, Business, Entertainment, Politics, Culture, Travel.\",\n \"url\": \"https://www.euronews.com/video/2026/01/04/latest-news-bulletin-january-4th-2026-morning\"\n }\n ]\n}</source>\n</context>\n\n<user_query>\nGive me extremely brief summary of today’s top 2 news.\n</user_query>\n\n\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>\n{\"type\": \"function\", \"function\": {\"name\": \"search_web\", \"description\": \"\\n Search the web for the given query.\\n \", \"parameters\": {\"type\": \"object\", \"required\": [\"query\"], \"properties\": {\"country\": {\"type\": \"string\", \"description\": \"The country to search from. Two letter country code.\"}, \"focus\": {\"type\": \"string\", \"description\": \"The type of search to perform. Can be \\\"all\\\", \\\"web\\\", \\\"news\\\", \\\"wikipedia\\\", \\\"academia\\\", \\\"reddit\\\", \\\"images\\\", \\\"videos\\\".\"}, \"language\": {\"type\": \"string\", \"description\": \"The language to search in. Language code like en, fr, de, etc.\"}, \"query\": {\"type\": \"string\", \"description\": \"The query to search for. Should be a string and optimized for search engines.\"}}}}}\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n<|im_start|>user\nGive me extremely brief summary of today’s top 2 news.<|im_end|>\n<|im_start|>assistant\n<tool_call>\n{\"name\": \"search_web\", \"arguments\": {\"focus\": \"news\", \"language\": \"en\", \"query\": \"today's top 2 news\"}}\n</tool_call><|im_end|>\n<|im_start|>user\n<tool_response>\n{\n \"results\": [\n {\n \"type\": \"web\",\n \"title\": \"Reuters World News | Latest Top Stories | Reuters\",\n \"age\": \"\",\n \"description\": \"A group of European countries, led by Britain and Germany, is discussing plans to boost their military presence in Greenland to show U.S. President Donald Trump that the continent is serious about Arctic security, Bloomberg News reported on Sunday.\",\n \"url\": \"https://www.reuters.com/world/\"\n },\n {\n \"type\": \"web\",\n \"title\": \"UK News - The latest headlines from the UK | Sky News\",\n \"age\": \"\",\n \"description\": \"'I have PTSD from online video': The growing call to ban smartphones in schools\",\n \"url\": \"https://news.sky.com/uk\"\n },\n {\n \"type\": \"web\",\n \"title\": \"Latest news from around the world | The Guardian\",\n \"age\": \"\",\n \"description\": \"Case brought by Muslim leaders and MP follows failed 2024 bid and seen as part of global anti-women’s rights backlash\",\n \"url\": \"https://www.theguardian.com/world\"\n },\n {\n \"type\": \"web\",\n \"title\": \"Breaking News, Latest News and Videos | CNN\",\n \"age\": \"\",\n \"description\": \"RFK Jr.’s new food pyramid puts meat, dairy at the top.\",\n \"url\": \"https://www.cnn.com/\"\n },\n {\n \"type\": \"web\",\n \"title\": \"World News - Breaking international news and headlines | Sky News\",\n \"age\": \"\",\n \"description\": \"There's a daily game of cat and mouse to catch illegal migrants in Germany - and it may soon become UK's problem\",\n \"url\": \"https://news.sky.com/world\"\n },\n {\n \"type\": \"web\",\n \"title\": \"UK | Latest News & Updates | BBC News\",\n \"age\": \"\",\n \"description\": \"Updates from your News topics will appear in My News and in a collection on the News homepage. I never saw young women on Epstein visits, Mandelson tells BBC · In his first interview since being sacked as the UK's US ambassador, Lord Mandelson also says he does not believe Donald Trump will take Greenland by force. ... Watch: Backlash against Musk's Grok AI explained. Video, 00:01:10Watch: Backlash against Musk's Grok AI explained ... Watch: Rowers capture close encounter with whales. Video, 00:00:25Watch: Rowers capture close encounter with whales\",\n \"url\": \"https://www.bbc.co.uk/news/uk\"\n },\n {\n \"type\": \"web\",\n \"title\": \"ABC News - Breaking News, Latest News and Videos\",\n \"age\": \"\",\n \"description\": \"The strikes come in retaliation for an attack that killed three Americans.\",\n \"url\": \"https://abcnews.go.com/\"\n },\n {\n \"type\": \"web\",\n \"title\": \"England | Latest News & Updates | BBC News\",\n \"age\": \"\",\n \"description\": \"Updates from your News topics will appear in My News and in a collection on the News homepage. 'I have 45 children applying to my special school each week' Head teacher Steph Smith says her school is oversubscribed and that more like it are needed. ... Man spotted skiing down residential street. Video, 00:00:16Man spotted skiing down residential street ... 0:45Prince Naseem actor on playing his hero. 00:00:45, play videoPrince Naseem actor on playing his hero · 0:28Cyclists get snow on their spokes in chilly ride.\",\n \"url\": \"https://www.bbc.co.uk/news/england\"\n },\n {\n \"type\": \"videos\",\n \"description\": \"Video. Catch up with the most important stories from around Europe and beyond - latest news, breaking news, World, Business, Entertainment, Politics, Culture, Travel.\",\n \"url\": \"https://www.euronews.com/video/2025/05/29/latest-news-bulletin-may-29th-evening\"\n },\n {\n \"type\": \"videos\",\n \"description\": \"President Donald Trump will receive an intelligence briefing today at 11 AM ET in the Oval Office. Trump will has lunch with Vice President JD Vance and then...\",\n \"url\": \"https://www.youtube.com/watch?v=rr014mxX1sg\"\n },\n {\n \"type\": \"videos\",\n \"description\": \"Get today's top stories, breaking news and original reporting on CBS News 24/7.#news #livenews #breakingnews CBS News 24/7 is the premier anchored streaming ...\",\n \"url\": \"https://www.youtube.com/watch?v=Jr0VVkRUqE4\"\n },\n {\n \"type\": \"videos\",\n \"description\": \"Video. Catch up with the most important stories from around Europe and beyond this January 4th, 2026 - latest news, breaking news, World, Business, Entertainment, Politics, Culture, Travel.\",\n \"url\": \"https://www.euronews.com/video/2026/01/04/latest-news-bulletin-january-4th-2026-morning\"\n }\n ]\n}\n</tool_response><|im_end|>\n<|im_start|>assistant\n"
SUBSEQUENT TURN (incorrectly encoded):
ollama[3261823]: time=2026-01-12T00:01:12.552Z level=TRACE source=server.go:1466 msg="completion request" prompt="<|im_start|>system\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>\n{\"type\": \"function\", \"function\": {\"name\": \"search_web\", \"description\": \"\\n Search the web for the given query.\\n \", \"parameters\": {\"type\": \"object\", \"required\": [\"query\"], \"properties\": {\"country\": {\"type\": \"string\", \"description\": \"The country to search from. Two letter country code.\"}, \"focus\": {\"type\": \"string\", \"description\": \"The type of search to perform. Can be \\\"all\\\", \\\"web\\\", \\\"news\\\", \\\"wikipedia\\\", \\\"academia\\\", \\\"reddit\\\", \\\"images\\\", \\\"videos\\\".\"}, \"language\": {\"type\": \"string\", \"description\": \"The language to search in. Language code like en, fr, de, etc.\"}, \"query\": {\"type\": \"string\", \"description\": \"The query to search for. Should be a string and optimized for search engines.\"}}}}}\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n<|im_start|>user\nGive me extremely brief summary of today’s top 2 news.<|im_end|>\n<|im_start|>assistant\n\""{\\n \\"results\\": [\\n {\\n \\"type\\": \\"web\\",\\n \\"title\\": \\"Reuters World News | Latest Top Stories | Reuters\\",\\n \\"age\\": \\"\\",\\n \\"description\\": \\"A group of European countries, led by Britain and Germany, is discussing plans to boost their military presence in Greenland to show U.S. President Donald Trump that the continent is serious about Arctic security, Bloomberg News reported on Sunday.\\",\\n \\"url\\": \\"https://www.reuters.com/world/\\"\\n },\\n {\\n \\"type\\": \\"web\\",\\n \\"title\\": \\"UK News - The latest headlines from the UK | Sky News\\",\\n \\"age\\": \\"\\",\\n \\"description\\": \\"&#x27;I have PTSD from online video&#x27;: The growing call to ban smartphones in schools\\",\\n \\"url\\": \\"https://news.sky.com/uk\\"\\n },\\n {\\n \\"type\\": \\"web\\",\\n \\"title\\": \\"Latest news from around the world | The Guardian\\",\\n \\"age\\": \\"\\",\\n \\"description\\": \\"Case brought by Muslim leaders and MP follows failed 2024 bid and seen as part of global anti-women’s rights backlash\\",\\n \\"url\\": \\"https://www.theguardian.com/world\\"\\n },\\n {\\n \\"type\\": \\"web\\",\\n \\"title\\": \\"Breaking News, Latest News and Videos | CNN\\",\\n \\"age\\": \\"\\",\\n \\"description\\": \\"RFK Jr.’s new food pyramid puts meat, dairy at the top.\\",\\n \\"url\\": \\"https://www.cnn.com/\\"\\n },\\n {\\n \\"type\\": \\"web\\",\\n \\"title\\": \\"World News - Breaking international news and headlines | Sky News\\",\\n \\"age\\": \\"\\",\\n \\"description\\": \\"There&#x27;s a daily game of cat and mouse to catch illegal migrants in Germany - and it may soon become UK&#x27;s problem\\",\\n \\"url\\": \\"https://news.sky.com/world\\"\\n },\\n {\\n \\"type\\": \\"web\\",\\n \\"title\\": \\"UK | Latest News & Updates | BBC News\\",\\n \\"age\\": \\"\\",\\n \\"description\\": \\"Updates from your News topics will appear in My News and in a collection on the News homepage. I never saw young women on Epstein visits, Mandelson tells BBC · In his first interview since being sacked as the UK&#x27;s US ambassador, Lord Mandelson also says he does not believe Donald Trump will take Greenland by force. ... Watch: Backlash against Musk&#x27;s Grok AI explained. Video, 00:01:10Watch: Backlash against Musk&#x27;s Grok AI explained ... Watch: Rowers capture close encounter with whales. Video, 00:00:25Watch: Rowers capture close encounter with whales\\",\\n \\"url\\": \\"https://www.bbc.co.uk/news/uk\\"\\n },\\n {\\n \\"type\\": \\"web\\",\\n \\"title\\": \\"ABC News - Breaking News, Latest News and Videos\\",\\n \\"age\\": \\"\\",\\n \\"description\\": \\"The strikes come in retaliation for an attack that killed three Americans.\\",\\n \\"url\\": \\"https://abcnews.go.com/\\"\\n },\\n {\\n \\"type\\": \\"web\\",\\n \\"title\\": \\"England | Latest News & Updates | BBC News\\",\\n \\"age\\": \\"\\",\\n \\"description\\": \\"Updates from your News topics will appear in My News and in a collection on the News homepage. &#x27;I have 45 children applying to my special school each week&#x27; Head teacher Steph Smith says her school is oversubscribed and that more like it are needed. ... Man spotted skiing down residential street. Video, 00:00:16Man spotted skiing down residential street ... 0:45Prince Naseem actor on playing his hero. 00:00:45, play videoPrince Naseem actor on playing his hero · 0:28Cyclists get snow on their spokes in chilly ride.\\",\\n \\"url\\": \\"https://www.bbc.co.uk/news/england\\"\\n },\\n {\\n \\"type\\": \\"videos\\",\\n \\"description\\": \\"Video. Catch up with the most important stories from around Europe and beyond - latest news, breaking news, World, Business, Entertainment, Politics, Culture, Travel.\\",\\n \\"url\\": \\"https://www.euronews.com/video/2025/05/29/latest-news-bulletin-may-29th-evening\\"\\n },\\n {\\n \\"type\\": \\"videos\\",\\n \\"description\\": \\"President Donald Trump will receive an intelligence briefing today at 11 AM ET in the Oval Office. Trump will has lunch with Vice President JD Vance and then...\\",\\n \\"url\\": \\"https://www.youtube.com/watch?v=rr014mxX1sg\\"\\n },\\n {\\n \\"type\\": \\"videos\\",\\n \\"description\\": \\"Get today's top stories, breaking news and original reporting on CBS News 24/7.#news #livenews #breakingnews CBS News 24/7 is the premier anchored streaming ...\\",\\n \\"url\\": \\"https://www.youtube.com/watch?v=Jr0VVkRUqE4\\"\\n },\\n {\\n \\"type\\": \\"videos\\",\\n \\"description\\": \\"Video. Catch up with the most important stories from around Europe and beyond this January 4th, 2026 - latest news, breaking news, World, Business, Entertainment, Politics, Culture, Travel.\\",\\n \\"url\\": \\"https://www.euronews.com/video/2026/01/04/latest-news-bulletin-january-4th-2026-morning\\"\\n }\\n ]\\n}"\"\n1. European countries, led by Britain and Germany, are discussing increased military presence in Greenland to address Arctic security concerns amid U.S. President Donald Trump's interest in the region [1]. \n2. There is a growing call to ban smartphones in schools due to concerns over mental health, with some individuals reporting PTSD from online video content [2].<|im_end|>\n<|im_start|>user\nmake it even shorter<|im_end|>\n<|im_start|>assistant\n"
Additional Information
AFAIK - When tool calls are executed in multi-turn conversations, the tool call results are stored in conversation history database with HTML-escaped entities (e.g., ", &) in the database. When these messages are loaded from the database and sent back to the LLM in subsequent conversation turns, the HTML entities in tool call results are not properly decoded, causing the model to receive malformed JSON with escaped entities instead of proper quotation marks.
The issue is not visible in the chat window, but it does have an impact on the model, degrading its performance, especially if the chat history is tool call heavy. I am not confident that the fix is correct, but I have observed this bug across different deployment instances and with both ollama and llama.cpp.
Suggested solution (?) tested working on my instance (main branch):
File: src/lib/utils/index.ts
Function: processDetails()
Line: ~875
// BEFORE:
if (attributes.result) {
content = content.replace(match, `"${attributes.result}"`);
}
// AFTER:
if (attributes.result) {
const unescapedResult = unescapeHtml(attributes.result);
content = content.replace(match, unescapedResult);
}