[GH-ISSUE #14080] issue: Uploaded files via API can't be accessed in Knowledge Base, but UI uploads work #17132

Closed
opened 2026-04-19 22:53:13 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @jalamax13 on GitHub (May 20, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/14080

Check Existing Issues

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

Installation Method

Git Clone

Open WebUI Version

v0.6.10

Ollama Version (if applicable)

No response

Operating System

Ubuntu 24.04.2

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 listed steps to reproduce the bug in detail.

Expected Behavior

Summary: When uploading files to a knowledge base via the API, the operation completes successfully (200 OK), but the knowledge becomes inaccessible in the user interface from version v0.6.6.

In Open WebUI v0.6.5, the same Python script and API workflow worked perfectly - downloaded files were accessible and the knowledge base could be opened and queried via the interface.

Since v0.6.6 and higher (tested in v0.6.10), the knowledge base becomes broken/inaccessible in the user interface after a file has been uploaded via the API.

Sample Python Script Used:

import requests

API_URL = "http://localhost:8080"
API_KEY = "sk-rezrzez"
KNOWLEDGE_ID = "rezrzez-rezrzez-rezrzez-rezrzez-rezrzez"
FILE_PATH = "/home/webui/scripts/glpi/files_glpi/ticket.txt"

headers_upload = {
    "Authorization": f"Bearer {API_KEY}",
    "Accept": "application/json"
}

headers_json = {
    "Authorization": f"Bearer {API_KEY}",
    "Content-Type": "application/json"
}

upload_url = f"{API_URL}/api/v1/files/"

with open(FILE_PATH, "rb") as f:
    files = {"file": f}
    upload_response = requests.post(upload_url, headers=headers_upload, files=files)

if upload_response.status_code == 200:
    file_id = upload_response.json().get("id")
    print(f"✅ Fichier téléversé avec succès. ID du fichier : {file_id}")
else:
    print(f"❌ Erreur lors du téléversement : {upload_response.status_code} - {upload_response.text}")
    exit(1)

associate_url = f"{API_URL}/api/v1/knowledge/{KNOWLEDGE_ID}/file/add"
data = {"file_id": file_id}

associate_response = requests.post(associate_url, headers=headers_json, json=data)

if associate_response.status_code == 200:
    print("✅ Fichier associé avec succès à la base de connaissances.")
else:
    print(f"❌ Erreur lors de l'association : {associate_response.status_code} - {associate_response.text}")

Actual Behavior

Hello,

When uploading a file to a knowledge base using the API, the system returns 200 OK and reports the knowledge base as updated. However, trying to access it via the UI causes a frontend crash.

Steps to reproduce:

Upload a file via /api/v1/files/ (even a minimal .txt file).

Associate it with the knowledge base using /api/v1/knowledge/{id}/file/add.

Go to the knowledge base in the UI.

Result:
The knowledge becomes inaccessible in the WebUI.
In the browser console, I get this error:

FileItemModal.svelte:28 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'startsWith')
at r.$$.update (FileItemModal.svelte:28:28)
at Pt (Component.js:144:5)
at new nt (FileItemModal.svelte:33:59)
at ze (FileItem.svelte:42:37)
at mt (FileItem.svelte:41:10)
at Pt (Component.js:148:34)
at new Vt (FileItem.svelte:63:19)
at gt (ArrowUpCircle.svelte:3:27)
at fl (Files.svelte:14:8)
at Pt (Component.js:148:34)

Uploading the same file via the UI interface (without API) works fine.

Tested on Open WebUI version 0.6.10.

Steps to Reproduce

.

Logs & Screenshots

FileItemModal.svelte:28 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'startsWith')
at r.$$.update (FileItemModal.svelte:28:28)
at Pt (Component.js:144:5)
at new nt (FileItemModal.svelte:33:59)
at ze (FileItem.svelte:42:37)
at mt (FileItem.svelte:41:10)
at Pt (Component.js:148:34)
at new Vt (FileItem.svelte:63:19)
at gt (ArrowUpCircle.svelte:3:27)
at fl (Files.svelte:14:8)
at Pt (Component.js:148:34)

Image

Additional Information

No response

Originally created by @jalamax13 on GitHub (May 20, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/14080 ### Check Existing Issues - [x] I have searched the existing issues and discussions. - [x] I am using the latest version of Open WebUI. ### Installation Method Git Clone ### Open WebUI Version v0.6.10 ### Ollama Version (if applicable) _No response_ ### Operating System Ubuntu 24.04.2 ### 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 listed steps to reproduce the bug in detail. ### Expected Behavior Summary: When uploading files to a knowledge base via the API, the operation completes successfully (200 OK), but the knowledge becomes inaccessible in the user interface from version v0.6.6. In Open WebUI v0.6.5, the same Python script and API workflow worked perfectly - downloaded files were accessible and the knowledge base could be opened and queried via the interface. Since v0.6.6 and higher (tested in v0.6.10), the knowledge base becomes broken/inaccessible in the user interface after a file has been uploaded via the API. Sample Python Script Used: ``` import requests API_URL = "http://localhost:8080" API_KEY = "sk-rezrzez" KNOWLEDGE_ID = "rezrzez-rezrzez-rezrzez-rezrzez-rezrzez" FILE_PATH = "/home/webui/scripts/glpi/files_glpi/ticket.txt" headers_upload = { "Authorization": f"Bearer {API_KEY}", "Accept": "application/json" } headers_json = { "Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json" } upload_url = f"{API_URL}/api/v1/files/" with open(FILE_PATH, "rb") as f: files = {"file": f} upload_response = requests.post(upload_url, headers=headers_upload, files=files) if upload_response.status_code == 200: file_id = upload_response.json().get("id") print(f"✅ Fichier téléversé avec succès. ID du fichier : {file_id}") else: print(f"❌ Erreur lors du téléversement : {upload_response.status_code} - {upload_response.text}") exit(1) associate_url = f"{API_URL}/api/v1/knowledge/{KNOWLEDGE_ID}/file/add" data = {"file_id": file_id} associate_response = requests.post(associate_url, headers=headers_json, json=data) if associate_response.status_code == 200: print("✅ Fichier associé avec succès à la base de connaissances.") else: print(f"❌ Erreur lors de l'association : {associate_response.status_code} - {associate_response.text}") ``` ### Actual Behavior Hello, When uploading a file to a knowledge base using the API, the system returns 200 OK and reports the knowledge base as updated. However, trying to access it via the UI causes a frontend crash. Steps to reproduce: Upload a file via /api/v1/files/ (even a minimal .txt file). Associate it with the knowledge base using /api/v1/knowledge/{id}/file/add. Go to the knowledge base in the UI. Result: The knowledge becomes inaccessible in the WebUI. In the browser console, I get this error: FileItemModal.svelte:28 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'startsWith') at r.$$.update (FileItemModal.svelte:28:28) at Pt (Component.js:144:5) at new nt (FileItemModal.svelte:33:59) at ze (FileItem.svelte:42:37) at mt (FileItem.svelte:41:10) at Pt (Component.js:148:34) at new Vt (FileItem.svelte:63:19) at gt (ArrowUpCircle.svelte:3:27) at fl (Files.svelte:14:8) at Pt (Component.js:148:34) Uploading the same file via the UI interface (without API) works fine. Tested on Open WebUI version 0.6.10. ### Steps to Reproduce . ### Logs & Screenshots FileItemModal.svelte:28 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'startsWith') at r.$$.update (FileItemModal.svelte:28:28) at Pt (Component.js:144:5) at new nt (FileItemModal.svelte:33:59) at ze (FileItem.svelte:42:37) at mt (FileItem.svelte:41:10) at Pt (Component.js:148:34) at new Vt (FileItem.svelte:63:19) at gt (ArrowUpCircle.svelte:3:27) at fl (Files.svelte:14:8) at Pt (Component.js:148:34) ![Image](https://github.com/user-attachments/assets/98c2a1ee-a20d-40db-8047-1622f2daad5b) ### Additional Information _No response_
GiteaMirror added the bug label 2026-04-19 22:53:13 -05:00
Author
Owner

@tjbck commented on GitHub (May 20, 2025):

Should be addressed with a8a9b35153

<!-- gh-comment-id:2894881067 --> @tjbck commented on GitHub (May 20, 2025): Should be addressed with a8a9b35153dd03196de3e101fa0a52ea15a56f35
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#17132