mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 02:48:13 -05:00
[GH-ISSUE #8889] User groups with write access to Knowledge base unable to upload files #15310
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 @btreich on GitHub (Jan 24, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/8889
Bug Report
Installation Method
Docker Swarm
Environment
Open WebUI Version: v0.5.7 (main branch)
Ollama (if applicable): 0.5.7-0-ga420a45-dirty
Operating System:
Browser (if applicable): Firefox 134.0.1 (64-bit)
Confirmation:
Expected Behavior:
Users in a group having the ability to upload files to their assigned knowledge base
Actual Behavior:
Users in the group faced an error stating they were unable to upload a file and to check permissions with their administrator
Description
Bug Summary:
When a knowledge base is created and write permissions are assigned to a group, users in the group are unable to upload files. A couple of messages stating "Failed to add file." and "You do not have permission to access this resource. Please contact your administrator for assistance." are presented to the users despite being assigned proper access.
Reproduction Details
Steps to Reproduce:
Logs and Screenshots
Browser Console Logs:
File { name: "test-data.txt", lastModified: 1737745202180, webkitRelativePath: "", size: 9, type: "text/plain" }
22.Dn9P5_ts.js:1:37942
Object { type: "file", file: "", id: null, url: "", name: "test-data.txt", size: 9, status: "uploading", error: "", itemId: "7f4df4b3-2f35-435a-a706-73e474cea6a2" }
FileItem.i5YYAUhZ.js:7:5828
Object { id: "5717ea48-4bef-4463-a0a6-9524b8ca1319", user_id: "0f22e1c6-9533-4fcf-8de4-622c698f9760", hash: "916f0027a575074ce72a331777c3478d6513f786a591bd892da1a577bf2335f9", filename: "test-data.txt", data: {…}, meta: {…}, created_at: 1737747492, updated_at: 1737747492 }
22.Dn9P5_ts.js:1:38491
XHRPOST
http://ai.internal:8080/api/v1/knowledge/e7f04996-dc7f-45cc-af12-ea7e06dced2f/file/add
[HTTP/1.1 400 Bad Request 25ms]
Object { detail: "You do not have permission to access this resource. Please contact your administrator for assistance." }
index.C1_J-sAl.js:1:2233
Object { detail: "You do not have permission to access this resource. Please contact your administrator for assistance." }
index.C1_J-sAl.js:1:2233
Docker Container Logs:
INFO [open_webui.routers.files] file.content_type: text/plain
INFO [open_webui.routers.retrieval] save_docs_to_vector_db: document test-data.txt file-5717ea48-4bef-4463-a0a6-9524b8ca1319
INFO [open_webui.routers.retrieval] adding to collection file-5717ea48-4bef-4463-a0a6-9524b8ca1319
Collection file-5717ea48-4bef-4463-a0a6-9524b8ca1319 does not exist.
INFO: 10.0.0.7:61574 - "POST /api/v1/files/ HTTP/1.1" 200 OK
INFO: 10.0.0.7:61574 - "POST /api/v1/knowledge/e7f04996-dc7f-45cc-af12-ea7e06dced2f/file/add HTTP/1.1" 400 Bad Request
INFO: 10.0.0.7:61624 - "GET /api/v1/chats/d3017cc1-4670-40d3-bf5d-cde120dd5956 HTTP/1.1" 200 OK
WARNI [python_multipart.multipart] Skipping data after last boundary
INFO [open_webui.routers.files] file.content_type: text/plain
INFO [open_webui.routers.retrieval] save_docs_to_vector_db: document test-data.txt file-d0c46c0b-6705-4442-9da6-ca9c298a3e19
INFO [open_webui.routers.retrieval] adding to collection file-d0c46c0b-6705-4442-9da6-ca9c298a3e19
Collection file-d0c46c0b-6705-4442-9da6-ca9c298a3e19 does not exist.
INFO: 10.0.0.7:61636 - "POST /api/v1/files/ HTTP/1.1" 200 OK
INFO: 10.0.0.7:61636 - "POST /api/v1/knowledge/e7f04996-dc7f-45cc-af12-ea7e06dced2f/file/add HTTP/1.1" 400 Bad Request
Screenshots/Screen Recordings (if applicable):
Additional Information
I did find if a user creates their own knowledge base, they are able to upload their files, but the issue still persists to anyone else in the group when following the same assignment steps.
Also, as seen briefly in my screen recording when assigning the group to the knowledge base, I was unable to initially change the group permissions from "Read" until I hit the "Access" button and switched it after the knowledge base creation.
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!
@cwthomas-llu commented on GitHub (Jan 24, 2025):
We ran into the same issue. It has to do with the code only allowing you to associate a file to a knowledge base if you are either the owner of the knowledge base or an admin. Please check out
b72150c881/backend/open_webui/routers/knowledge.py (L267)This check needs to be changed to allow people with RW access to associate a file with a knowledge base. This same issue appears when listing knowledge bases and doing other knowledge base operations.This issue makes it very difficult to have a service account do stuff without being either an admin or owning the knowledge base.
@btreich commented on GitHub (Jan 24, 2025):
Definitely agree on the difficulty factor. We currently have users we are trying to allow uploading of their own files so they don't have to go through admins, which this issue is hindering that ability.
Looking at the file you linked, it appears to me like the
knowledgeobject has the ability to look at its ACL via theaccess_controlproperty, which also shows in the class definition what is stored in the property:b72150c881/backend/open_webui/models/knowledge.py (L27-L57)Also, something similar seems to be done in the
update_knowledge_by_idrouting function above it to check user permissions on the knowledge base ACL:b72150c881/backend/open_webui/routers/knowledge.py (L216-L225)Unless I'm misreading the code, it might be as simple as adding that additional check?
@tjbck commented on GitHub (Jan 27, 2025):
@tarmst
@NovaYear commented on GitHub (Jan 27, 2025):
open-webui=0.5.7. not working file upload.
I think I have the same problem. The open-webui process ends without reporting any errors during the file upload process. There was no such problem in the previous version 0.5.4, it appeared after I updated to version 0.5.7 last night.
windows.console output ::
firefox.browser.console output::
@tarmst commented on GitHub (Jan 27, 2025):
Sorry for the delay! I can take a look and hopefully submit a PR today. It probably is as simple as adding the check that btreich suggested.
Out of curiosity, was the groups read/write added to 0.5.4 and working? I'm not sure which version it was originally added to.
Edit: I see NovaYear says it was working with 0.5.4, I just want to double check.
@kunaltyagi commented on GitHub (Feb 1, 2025):
I have this issue with ghcr.io image (
main). Is this related?@tarmst commented on GitHub (Feb 14, 2025):
@btreich Is this working for you now in the most recent release? If so, we could ask the owners to close it.
@btreich commented on GitHub (Feb 14, 2025):
@tarmst The issue looks to be resolved when I tested it again with v0.5.12. I believe we can close it. Thank you for all of the help!
@zhaowei0315 commented on GitHub (Feb 24, 2025):
Hello All,
is it solved?
I create a knowledge base and set is as public.
but the normal user cannot see it and upload files to it.
how can make it possible?
thank you very much.
BR,
Felix
@ivanbaldo commented on GitHub (Mar 17, 2025):
Related to this, the users can't download the source document, see https://github.com/open-webui/open-webui/discussions/7578 .