mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-16 14:39:31 -05:00
[GH-ISSUE #17198] issue: Duplicated system prompt in the request #33732
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 @DanielusG on GitHub (Sep 4, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/17198
Check Existing Issues
Installation Method
Docker
Open WebUI Version
v0.6.26
Ollama Version (if applicable)
No response
Operating System
Garuda Linux
Browser (if applicable)
No response
Confirmation
README.md.Expected Behavior
It should only send a system instruction to the provider.
Actual Behavior
Duplicate system instructions are being sent
Steps to Reproduce
I tried both with Docker and by installing via
uvxusing the commandDATA_DIR=~/.open-webui uvx --python 3.11 open-webui@latest serve --port 8082Logs & Screenshots
{"stream":true,"model":"GPT-OSS-20B-Cline","messages":[{"role":"system","content":"You talk as a pirate"},{"role":"user","content":"hi"}],"params":{"system":"You talk as a pirate"},"tool_servers":[],"features":{"image_generation":false,"code_interpreter":false,"web_search":false,"memory":false},"variables":{"{{USER_NAME}}":"User","{{USER_LOCATION}}":"Unknown","{{CURRENT_DATETIME}}":"2025-09-04 11:54:56","{{CURRENT_DATE}}":"2025-09-04","{{CURRENT_TIME}}":"11:54:56","{{CURRENT_WEEKDAY}}":"Thursday","{{CURRENT_TIMEZONE}}":"Europe/Rome","{{USER_LANGUAGE}}":"it-IT"},"model_item":{"id":"GPT-OSS-20B-Cline","object":"model","created":1677610602,"owned_by":"openai","connection_type":"external","name":"GPT-OSS-20B-Cline","openai":{"id":"GPT-OSS-20B-Cline","object":"model","created":1677610602,"owned_by":"openai","connection_type":"external"},"urlIdx":0,"actions":[],"filters":[],"tags":[]},"session_id":"a91VsVEKryJM73ioAAAB","chat_id":"386e91ea-56a8-4a34-967f-d3e2b0941e51","id":"3139f820-ee16-4931-856e-562ac703c599","background_tasks":{"title_generation":true,"tags_generation":true,"follow_up_generation":true}}Additional Information
I narrowed the problem area and determined that it is an OWUI bug. I confirmed this by using a different client to submit requests; the requests were logged correctly.
My Docker installation was running version v0.6.25. After detecting the bug, I upgraded to v0.6.26, yet the issue remained.
To rule out environment‑specific factors, I set up a fresh machine with no prior OWUI installation and executed the following command:
DATA_DIR=~/.open-webui uvx --python 3.11 open-webui@latest serve --port 8082@rgaricano commented on GitHub (Sep 4, 2025):
I can see all the log but seem that it have configurated title & tag generation, if it's the case there are one request for each generation (tittle & tags)
@DanielusG commented on GitHub (Sep 4, 2025):
I'm not referring to multiple requests, but rather a single request containing the 'system' field with the system instruction value duplicated – specifically, it appears twice, separated by a newline character (\n), as can be seen in the screenshot.
For the sake of completeness, I will also specify that in the Docker installation, I have disabled the generation of tag titles, etc. The request sent is a single one, and it contains that error.
@rgaricano commented on GitHub (Sep 4, 2025):
Sorry Danielle, but I don't see it.
i only see a json with this info (a normal request):
If you ask about roles system & user messages,
It isn't a bug, It's how, right now, it work: the whole conversation is sended, and those are 2 messages. It's the providers protocol.
Yes, it's a waste of resources and not very logical, which is why history and cache systems are being implemented in this kind of systems and services.
I also hope that in Open-WebUI, at least for locally served models, we can achieve these types of improvements, but with respect to external providers, it will always depend on their protocols.
(maybe I'm offuscated but I can't see any duplicated system and new line in the screenshots provided)
@Ithanil commented on GitHub (Sep 5, 2025):
I also don't reproduce, but because this has been reported before (https://github.com/open-webui/open-webui/issues/16855) I assume there is an actual issue to be reproduced somehow.
@rgaricano I'm still not sure you understood the report. It says the system prompt string gets duplicated inside the system message content. Nothing else.
@DanielusG commented on GitHub (Sep 5, 2025):
I believe the confusion arises from the fact that I added a log that is correctly structured.
In my report you can see that I added three screenshots.
The first image shows what the end user clearly sees and what they expect the provider to receive as a request.
The second screenshot captures the browser’s HTTP request (OpenWebUI frontend → OpenWebUI backend) and shows that the request is correctly formulated and contains no duplicates.
The error occurs during the transition from the OpenWebUI backend to the provider (in this case LiteLLM). As shown in the last screenshot, the system message received by LiteLLM is “You talk as a pirate\nYou talk as a pirate” even though my prompt was simply “You talk as a pirate”.
To reproduce the bug I created a very simple backend that emulates an LLM provider and logs the system prompt received in the terminal.
Steps to reproduce the issue:
fastapianduvicornin a Python environment.Middleware code:
@rgaricano commented on GitHub (Sep 5, 2025):
Ok, now I saw it, ...yes, I was offuscated.
I did tests with dev branch(I was running), and I can't reproduce:
(I edited the dumb server to show more detailed info)
And with main v0.6.26
@DanielusG commented on GitHub (Sep 5, 2025):
Try to set the system prompt manually, it seems like the system prompt from the memory feature right? Try to define a pirate prompt like in my case
@rgaricano commented on GitHub (Sep 5, 2025):
yes, i see
(tested with dev branch)
@rgaricano commented on GitHub (Sep 5, 2025):
The duplication occurs because apply_system_prompt_to_body calls add_or_update_system_message multiple times during request processing.
The fix (as is a small function I put the whole function)
Replace function:
2407d9b905/backend/open_webui/utils/misc.py (L138)by:
now working with the fix:
NOTE:
I didn't made a PR, sure that @tjbck find a better way.
@DanielusG commented on GitHub (Sep 30, 2025):
Any news? For those who heavily use system prompts in OpenWebUI, this bug is extremely penalizing; the models do not respond well to duplicated system prompts. For example, if the prompt were 11k tokens, the provider and the model receive a full 22k of duplicate instructions. it's a critical bug!
@tjbck commented on GitHub (Oct 2, 2025):
Should be addressed with a1fc99c66fc62fcea98cdbef2e23ddbc7a7465b5!