Can't delete chat (dev branch) #2248

Closed
opened 2025-11-11 15:03:19 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @bgeneto on GitHub (Sep 30, 2024).

Bug Report

Installation Method

Docker compose linux

Environment

  • Open WebUI Version: v0.3.30

  • Ollama (if applicable): 0.3.12

  • Operating System: Debian 12

  • Browser (if applicable): Chrome 120.0

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:

The user should be able to delete a chat successfully, and the system should handle the deletion request without errors.

Actual Behavior:

When attempting to delete a user chat, the system raises a KeyError exception due to a missing configuration key. The error occurs in the delete_chat_by_id function in the chats.py file.

Description

Bug Summary:
The delete_chat_by_id function in the chats.py file attempts to access a configuration key that does not exist, resulting in a KeyError exception. This prevents the user from deleting a chat successfully.

Reproduction Details

Steps to Reproduce:

Start the Open WebUI application.
0. Create a new user (non-admin)

  1. Log in as the just created user (ensure chat deletion permissions: USER_PERMISSIONS_CHAT_DELETION=true).
  2. Navigate to the chat interface and select a chat to delete (...).
  3. Click the "Delete" button to initiate the deletion process.
  4. The system will raise a KeyError exception in the delete_chat_by_id function, located in the chats.py file, due to the missing configuration key.

Logs and Screenshots

Browser Console Logs:

Docker Container Logs:


  File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
  File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 72, in app
    response = await func(request)
               ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 278, in app
    raw_response = await run_endpoint_function(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 191, in run_endpoint_function
    return await dependant.call(**values)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/backend/open_webui/apps/webui/routers/chats.py", line 295, in delete_chat_by_id
    if not request.app.state.config.USER_PERMISSIONS["chat"]["deletion"]:
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
KeyError: 'chat'

Screenshots/Screen Recordings (if applicable):

image

Additional Information

I'm using de dev branch pulled today (2024-09-30)

Note

If the bug report is incomplete or does not follow the provided instructions, it may not be addressed. Please ensure that you have followed the steps outlined in the README.md and troubleshooting.md documents, and provide all necessary information for us to reproduce and address the issue. Thank you!

Originally created by @bgeneto on GitHub (Sep 30, 2024). # Bug Report ## Installation Method Docker compose linux ## Environment - **Open WebUI Version:** v0.3.30 - **Ollama (if applicable):** 0.3.12 - **Operating System:** Debian 12 - **Browser (if applicable):** Chrome 120.0 **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: The user should be able to delete a chat successfully, and the system should handle the deletion request without errors. ## Actual Behavior: When attempting to delete a user chat, the system raises a KeyError exception due to a missing configuration key. The error occurs in the delete_chat_by_id function in the chats.py file. ## Description **Bug Summary:** The delete_chat_by_id function in the chats.py file attempts to access a configuration key that does not exist, resulting in a KeyError exception. This prevents the user from deleting a chat successfully. ## Reproduction Details **Steps to Reproduce:** Start the Open WebUI application. 0. Create a new user (non-admin) 1. Log in as the just created user (ensure chat deletion permissions: USER_PERMISSIONS_CHAT_DELETION=true). 2. Navigate to the chat interface and select a chat to delete (...). 3. Click the "Delete" button to initiate the deletion process. 4. The system will raise a KeyError exception in the delete_chat_by_id function, located in the chats.py file, due to the missing configuration key. ## Logs and Screenshots **Browser Console Logs:** **Docker Container Logs:** ```text File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app await app(scope, receive, sender) File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 72, in app response = await func(request) ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 278, in app raw_response = await run_endpoint_function( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 191, in run_endpoint_function return await dependant.call(**values) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/backend/open_webui/apps/webui/routers/chats.py", line 295, in delete_chat_by_id if not request.app.state.config.USER_PERMISSIONS["chat"]["deletion"]: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^ KeyError: 'chat' ``` **Screenshots/Screen Recordings (if applicable):** ![image](https://github.com/user-attachments/assets/cf24fc5c-7c2d-4b30-b9c6-8861c88a9849) ## Additional Information I'm using de dev branch pulled today (2024-09-30) ## Note If the bug report is incomplete or does not follow the provided instructions, it may not be addressed. Please ensure that you have followed the steps outlined in the README.md and troubleshooting.md documents, and provide all necessary information for us to reproduce and address the issue. Thank you!
Author
Owner

@silentoplayz commented on GitHub (Oct 1, 2024):

I'm personally unable to replicate the error with the reproduction steps provided. I am also on the dev branch using the latest commit.

@silentoplayz commented on GitHub (Oct 1, 2024): I'm personally unable to replicate the error with the reproduction steps provided. I am also on the dev branch using the latest commit.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#2248