[GH-ISSUE #17143] issue: Removing a file from knowledge via the API results in the complete removal of the file #18183

Closed
opened 2026-04-20 00:23:53 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @DirkRemmers on GitHub (Sep 2, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/17143

Check Existing Issues

  • I have searched the existing issues and discussions.
  • I am using the latest version of Open WebUI.

Installation Method

Docker

Open WebUI Version

v0.6.22

Ollama Version (if applicable)

No response

Operating System

Debian

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

When using the following API endpoint: POST /api/v1/knowledge/{knowledge_id}/file/remove, the file that is specified in the data should be deleted only from the knowledge collection, not from the entire system.

Actual Behavior

Instead, when I use the following api endpoint: POST /api/v1/knowledge/{knowledge_id}/file/remove, the file is removed from the system entirely

Steps to Reproduce

To reproduce:

  1. add a file to the database (POST /api/v1/files/) and get the id (file_id)
  2. validate the file is added (GET /api/v1/files/{file_id})
  3. create a knowledge collection (POST /api/v1/knowledge/create) and get the id (knowledge_id)
  4. add the file to the knowledge collection (POST /api/v1/knowledge/{knowledge_id}/file/add with data = {"file_id"=file_id})
  5. remove the file from the knowledge collection (POST /api/v1/knowledge/{knowledge_id}/file/remove with `data={"file_id"=file_id})
  6. try and find the file again (GET /api/v1/files/{file_id})

Logs & Screenshots

Additional Information

I don't believe this is the intended behaviour, so I guess this should be fixed?

Cheers,
Dirk

Originally created by @DirkRemmers on GitHub (Sep 2, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/17143 ### Check Existing Issues - [x] I have searched the existing issues and discussions. - [x] I am using the latest version of Open WebUI. ### Installation Method Docker ### Open WebUI Version v0.6.22 ### Ollama Version (if applicable) _No response_ ### Operating System Debian ### 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 When using the following API endpoint: `POST /api/v1/knowledge/{knowledge_id}/file/remove`, the file that is specified in the `data` should be deleted only from the knowledge collection, not from the entire system. ### Actual Behavior Instead, when I use the following api endpoint: `POST /api/v1/knowledge/{knowledge_id}/file/remove`, the file is removed from the system entirely ### Steps to Reproduce To reproduce: 1. add a file to the database (`POST /api/v1/files/`) and get the id (file_id) 2. validate the file is added (`GET /api/v1/files/{file_id}`) 3. create a knowledge collection (`POST /api/v1/knowledge/create`) and get the id (knowledge_id) 4. add the file to the knowledge collection (`POST /api/v1/knowledge/{knowledge_id}/file/add` with `data = {"file_id"=file_id}`) 5. remove the file from the knowledge collection (`POST /api/v1/knowledge/{knowledge_id}/file/remove` with `data={"file_id"=file_id}) 6. try and find the file again (`GET /api/v1/files/{file_id}`) ### Logs & Screenshots - ### Additional Information I don't believe this is the intended behaviour, so I guess this should be fixed? Cheers, Dirk
GiteaMirror added the bug label 2026-04-20 00:23:53 -05:00
Author
Owner

@Classic298 commented on GitHub (Sep 2, 2025):

When using the following API endpoint: POST /api/v1/knowledge/{knowledge_id}/file/remove, the file that is specified in the data should be deleted only from the knowledge collection, not from the entire system.

not from the entire system.

What do you mean by this?

If you remove a file from the knowledge base, of course the file becomes unusable in Open WebUI as there is no longer any active reference to the file.

But the file IS kept on disk and in the vector database for data retention purposes.
But it is unusable from the web ui.

If that is your question, yes it is intended that the file is removed and becomes unusable from the webui after you remove (delete) it from a knowledge collection (and why would it not be?)

<!-- gh-comment-id:3245966138 --> @Classic298 commented on GitHub (Sep 2, 2025): > When using the following API endpoint: POST /api/v1/knowledge/{knowledge_id}/file/remove, the file that is specified in the data should be deleted only from the knowledge collection, not from the entire system. > **not from the entire system.** What do you mean by this? If you remove a file from the knowledge base, of course the file becomes unusable in Open WebUI as there is no longer any active reference to the file. But the file IS kept on disk and in the vector database for data retention purposes. But it is unusable from the web ui. If that is your question, yes it is intended that the file is removed and becomes unusable from the webui after you remove (delete) it from a knowledge collection (and why would it not be?)
Author
Owner

@tjbck commented on GitHub (Sep 2, 2025):

22c4ef4fb0

<!-- gh-comment-id:3246220509 --> @tjbck commented on GitHub (Sep 2, 2025): 22c4ef4fb096498066b73befe993ae3a82f7a8e7
Author
Owner

@DirkRemmers commented on GitHub (Sep 3, 2025):

@Classic298 , using the API, you can upload files without adding them to any knowledge base. You can then link the file to knowledge bases using the id that the file then gets. This allows you to (for example) link it to multiple knowledge bases.

It should still be possible to remove the file from one knowledge base, and then link it to another knowledge base. For this, the id of the file needs to remain, and therefore the file needs to remain.

Your logic also makes sense in the use case that a document is only added to one knowledge base of course.

I think the fix that @tjbck created is a good one, it will allow users to specify if the entire file needs to be removed or not, providing the user with the possibility to describe what I just explained.

Thanks for the quick fix!

Cheers,
Dirk

<!-- gh-comment-id:3247918878 --> @DirkRemmers commented on GitHub (Sep 3, 2025): @Classic298 , using the API, you can upload files without adding them to any knowledge base. You can then link the file to knowledge bases using the id that the file then gets. This allows you to (for example) link it to multiple knowledge bases. It should still be possible to remove the file from one knowledge base, and then link it to another knowledge base. For this, the id of the file needs to remain, and therefore the file needs to remain. Your logic also makes sense in the use case that a document is only added to one knowledge base of course. I think the fix that @tjbck created is a good one, it will allow users to specify if the entire file needs to be removed or not, providing the user with the possibility to describe what I just explained. Thanks for the quick fix! Cheers, Dirk
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#18183