[GH-ISSUE #4428] bug: duplicate tags #13605

Closed
opened 2026-04-19 20:17:07 -05:00 by GiteaMirror · 7 comments
Owner

Originally created by @ProjectMoon on GitHub (Aug 7, 2024).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/4428

Bug Report

Installation Method

Docker

Environment

  • Open WebUI Version: v0.3.12
  • Operating System: Gentoo Linux
  • Browser (if applicable): Firefox

Confirmation:

  • I have read and followed all the instructions provided in the README.md.
  • I am on 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 the exact steps to reproduce the bug in the "Steps to Reproduce" section below.

Expected Behavior:

When adding a tag to a chat, if that tag already exists, there's a large chance that it will be duplicated both in the sidebar tag list, and in the list of tags on the chat itself.

Actual Behavior:

One tag = one tag. Do not display duplicates of the same tags.

Description

Bug Summary:
When using a tag that already exists, the UI will duplicate it. However, there seems to only be a single tag stored on the chat in the backend.

Reproduction Details

Steps to Reproduce:
Tag multiple chats with the same tag. I think there might be some more factors at play here, because sometimes the duplication is 2x, or 3x, or even 4x. It doesn't necessarily seem related to the number of chats with the same tag.

Logs and Screenshots

Screenshots/Screen Recordings (if applicable):
image
image

Originally created by @ProjectMoon on GitHub (Aug 7, 2024). Original GitHub issue: https://github.com/open-webui/open-webui/issues/4428 # Bug Report ## Installation Method Docker ## Environment - **Open WebUI Version:** v0.3.12 - **Operating System:** Gentoo Linux - **Browser (if applicable):** Firefox **Confirmation:** - [X] I have read and followed all the instructions provided in the README.md. - [X] I am on the latest version of both Open WebUI and Ollama. - [X] I have included the browser console logs. - [X] I have included the Docker container logs. - [X] I have provided the exact steps to reproduce the bug in the "Steps to Reproduce" section below. ## Expected Behavior: When adding a tag to a chat, if that tag already exists, there's a large chance that it will be duplicated both in the sidebar tag list, and in the list of tags on the chat itself. ## Actual Behavior: One tag = one tag. Do not display duplicates of the same tags. ## Description **Bug Summary:** When using a tag that already exists, the UI will duplicate it. However, there seems to only be a single tag stored on the chat in the backend. ## Reproduction Details **Steps to Reproduce:** Tag multiple chats with the same tag. I think there might be some more factors at play here, because sometimes the duplication is 2x, or 3x, or even 4x. It doesn't necessarily seem related to the number of chats with the same tag. ## Logs and Screenshots **Screenshots/Screen Recordings (if applicable):** ![image](https://github.com/user-attachments/assets/dd60978f-0a4b-43a8-9092-a82919e0cc26) ![image](https://github.com/user-attachments/assets/41322f2f-4105-4fdc-a5c0-84bb051150f6)
Author
Owner

@tjbck commented on GitHub (Aug 7, 2024):

I'm unable to reproduce this issue, if someone could describe a step by step method to reproduce I'd greatly appreciate it!

<!-- gh-comment-id:2273543357 --> @tjbck commented on GitHub (Aug 7, 2024): I'm unable to reproduce this issue, if someone could describe a step by step method to reproduce I'd greatly appreciate it!
Author
Owner

@ProjectMoon commented on GitHub (Aug 7, 2024):

Here is a bit more info:
image
It looks like my assumption about the backend was wrong; these tags are returned with different IDs.

I wonder if this is related to a DB migration that happened at some point along the way. This only started showing up after one of the recent releases (unsure of which one, exactly). They show up as duplicates in the database too.

So it seems like duplicate tags in DB + UI that expects unique tag names = this problem.

<!-- gh-comment-id:2273597987 --> @ProjectMoon commented on GitHub (Aug 7, 2024): Here is a bit more info: ![image](https://github.com/user-attachments/assets/ae19ee99-164f-4841-b9dd-2a992cfc9f02) It looks like my assumption about the backend was wrong; these tags are returned with different IDs. I wonder if this is related to a DB migration that happened at some point along the way. This only started showing up after one of the recent releases (unsure of which one, exactly). They show up as duplicates in the database too. So it seems like duplicate tags in DB + UI that expects unique tag names = this problem.
Author
Owner

@ProjectMoon commented on GitHub (Aug 7, 2024):

Also, I've got a tag table and a chatidtag table. Which one is used? Are both used? o_O

<!-- gh-comment-id:2273605851 --> @ProjectMoon commented on GitHub (Aug 7, 2024): Also, I've got a `tag` table and a `chatidtag` table. Which one is used? Are both used? o_O
Author
Owner

@ProjectMoon commented on GitHub (Aug 7, 2024):

I was able to "fix" this by deleting all but one of the duplicated tags. The duplicated tags can be found by a query like this (sqlite):

select name, count(name), group_concat(id) as duplicated_ids 
from tag group by user_id, name having count(name) > 1;

This does not, however, help reproduce it. My money is still on a DB migration.

<!-- gh-comment-id:2273637146 --> @ProjectMoon commented on GitHub (Aug 7, 2024): I was able to "fix" this by deleting all but one of the duplicated tags. The duplicated tags can be found by a query like this (sqlite): ```sql select name, count(name), group_concat(id) as duplicated_ids from tag group by user_id, name having count(name) > 1; ``` This does not, however, help reproduce it. My money is still on a DB migration.
Author
Owner

@tjbck commented on GitHub (Oct 15, 2024):

Should be addressed with cf24a65caa in dev.

<!-- gh-comment-id:2412972261 --> @tjbck commented on GitHub (Oct 15, 2024): Should be addressed with cf24a65caa6b5602a73dbb6cc83dfbfb976286ef in dev.
Author
Owner

@AndroidHemroid commented on GitHub (Oct 26, 2024):

This still seems to be an issue with the latest 3.33 Duplicate chats start popping up in the sidebar. It seems to be triggered by using the search adding a couple words in it then just backspace over the last word entered. The sidebar pulls in what is searched. And once you clear out the search field, duplicates seem to be in the sidebar of some of the chats. It seems like DB index for the chat history or sidebar values are getting pulled in and contaminating the actually master index.

A possible future fix would be to add two new fields to the DB where chats would have a date & time stamp as well as a Unique sequential record number. Then add a DB integrity verifier that would create an integrity index DB sorted by date of chat as well as record# then build a new cleanup Index DB that would filter out the duplicates. Also, it may be the bulk export or import of chats stage contaminating also. But seems to show up just after using the search more so just after the bulk import of chats which seems to leave out some of the backed up chats and pop up just after using the search but with duplicates.

I am going to go see if it repeats the problem on 3.34 which just come out today.

<!-- gh-comment-id:2439572459 --> @AndroidHemroid commented on GitHub (Oct 26, 2024): This still seems to be an issue with the latest 3.33 Duplicate chats start popping up in the sidebar. It seems to be triggered by using the search adding a couple words in it then just backspace over the last word entered. The sidebar pulls in what is searched. And once you clear out the search field, duplicates seem to be in the sidebar of some of the chats. It seems like DB index for the chat history or sidebar values are getting pulled in and contaminating the actually master index. A possible future fix would be to add two new fields to the DB where chats would have a date & time stamp as well as a Unique sequential record number. Then add a DB integrity verifier that would create an integrity index DB sorted by date of chat as well as record# then build a new cleanup Index DB that would filter out the duplicates. Also, it may be the bulk export or import of chats stage contaminating also. But seems to show up just after using the search more so just after the bulk import of chats which seems to leave out some of the backed up chats and pop up just after using the search but with duplicates. I am going to go see if it repeats the problem on 3.34 which just come out today.
Author
Owner

@tjbck commented on GitHub (Oct 26, 2024):

@AndroidHemroid would appreciate your help here, PR welcome!

<!-- gh-comment-id:2439729483 --> @tjbck commented on GitHub (Oct 26, 2024): @AndroidHemroid would appreciate your help here, PR welcome!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#13605