[GH-ISSUE #20964] issue: psycopg2.errors.UniqueViolation: duplicate key value violates unique constraint "uq_chat_file_chat_file" #122655

Closed
opened 2026-05-21 01:35:37 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @Abdelrahman1993 on GitHub (Jan 27, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/20964

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

Docker

Open WebUI Version

v0.7.2

Ollama Version (if applicable)

No response

Operating System

Docker

Browser (if applicable)

No response

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

No duplicate key value violates unique constraint errors

Actual Behavior

Since I upgrade from v0.6.40 to v0.7.2, I noticed the below error triggered multiple times at DataDog error

DETAIL:  Key (chat_id, file_id)=(80186739-db23-42ae-b3bf-840a673cd7f3, 859249d4-2bf1-4557-bc74-72f21a5090f9) already exists.

Traceback (most recent call last):
  File "/opt/datadog/apm/library/python/ddtrace_pkgs/site-packages-ddtrace-py3.11-manylinux2014/ddtrace/contrib/dbapi.py", line 116, in _trace_method
    return method(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^
psycopg2.errors.UniqueViolation: duplicate key value violates unique constraint "uq_chat_file_chat_file"
DETAIL:  Key (chat_id, file_id)=(80186739-db23-42ae-b3bf-840a673cd7f3, 859249d4-2bf1-4557-bc74-72f21a5090f9) already exists.

Steps to Reproduce

Upgrade from version from v0.6.40 to v0.7.2 version

Logs & Screenshots

Image

Additional Information

I run 2 instance of OpenWeb UI in K8s cluster with AWS ALB Loadbalancer
Using Qdrant as vector storage
Use PostgreSQL Database

Originally created by @Abdelrahman1993 on GitHub (Jan 27, 2026). Original GitHub issue: https://github.com/open-webui/open-webui/issues/20964 ### Check Existing Issues - [x] I have searched for any existing and/or related issues. - [x] I have searched for any existing and/or related discussions. - [x] 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!). - [x] I am using the latest version of Open WebUI. ### Installation Method Docker ### Open WebUI Version v0.7.2 ### Ollama Version (if applicable) _No response_ ### Operating System Docker ### Browser (if applicable) _No response_ ### Confirmation - [x] I have read and followed all instructions in `README.md`. - [x] I am using 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 every relevant configuration, setting, and environment variable used in my setup.** - [x] 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). - [x] 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 No duplicate key value violates unique constraint errors ### Actual Behavior Since I upgrade from v0.6.40 to v0.7.2, I noticed the below error triggered multiple times at DataDog error ```psycopg2.errors.UniqueViolation: duplicate key value violates unique constraint "uq_chat_file_chat_file" DETAIL: Key (chat_id, file_id)=(80186739-db23-42ae-b3bf-840a673cd7f3, 859249d4-2bf1-4557-bc74-72f21a5090f9) already exists. Traceback (most recent call last): File "/opt/datadog/apm/library/python/ddtrace_pkgs/site-packages-ddtrace-py3.11-manylinux2014/ddtrace/contrib/dbapi.py", line 116, in _trace_method return method(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^ psycopg2.errors.UniqueViolation: duplicate key value violates unique constraint "uq_chat_file_chat_file" DETAIL: Key (chat_id, file_id)=(80186739-db23-42ae-b3bf-840a673cd7f3, 859249d4-2bf1-4557-bc74-72f21a5090f9) already exists. ``` ### Steps to Reproduce Upgrade from version from v0.6.40 to v0.7.2 version ### Logs & Screenshots <img width="984" height="879" alt="Image" src="https://github.com/user-attachments/assets/de3f5fe6-4af6-4a30-961b-6825f7812059" /> ### Additional Information I run 2 instance of OpenWeb UI in K8s cluster with AWS ALB Loadbalancer Using Qdrant as vector storage Use PostgreSQL Database
GiteaMirror added the bug label 2026-05-21 01:35:37 -05:00
Author
Owner

@tjbck commented on GitHub (Jan 29, 2026):

Unable to reproduce, you may have to delete the chat entry with that id manually.

<!-- gh-comment-id:3818725955 --> @tjbck commented on GitHub (Jan 29, 2026): Unable to reproduce, you may have to delete the chat entry with that id manually.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#122655