[PR #23238] [CLOSED] fix: remove invalid db kwarg from process_files_batch call #27099

Closed
opened 2026-04-20 06:52:21 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/23238
Author: @IgnazioDS
Created: 3/30/2026
Status: Closed

Base: mainHead: fix/process-files-batch-db-kwarg


📝 Commits (1)

  • 83dae63 fix: remove invalid db kwarg from process_files_batch call

📊 Changes

1 file changed (+0 additions, -1 deletions)

View changed files

📝 backend/open_webui/routers/knowledge.py (+0 -1)

📄 Description

Summary

process_files_batch() does not accept a db keyword argument, but add_files_to_knowledge_batch passes db=db when calling it, which raises a TypeError at runtime.

Root cause: The function signature in routers/retrieval.py intentionally omits db because it makes long-running external embedding API calls (5–60+ seconds) and manages its own short-lived DB sessions internally.

Fix: Remove the db=db line from the call in knowledge.py.

Fixes #23137

Change

# Before
result = await process_files_batch(
    request=request,
    form_data=BatchProcessFilesForm(files=files, collection_name=id),
    user=user,
    db=db,   # ← TypeError: unexpected keyword argument
)

# After
result = await process_files_batch(
    request=request,
    form_data=BatchProcessFilesForm(files=files, collection_name=id),
    user=user,
)

Test plan

  • Call POST /api/v1/knowledge/{id}/files/batch with a valid collection — should no longer raise TypeError: process_files_batch() got an unexpected keyword argument 'db'
  • Verify files are still processed and added to the knowledge collection correctly

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/23238 **Author:** [@IgnazioDS](https://github.com/IgnazioDS) **Created:** 3/30/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/process-files-batch-db-kwarg` --- ### 📝 Commits (1) - [`83dae63`](https://github.com/open-webui/open-webui/commit/83dae63b69c18bff1fc652cecd00cebcd553df2b) fix: remove invalid db kwarg from process_files_batch call ### 📊 Changes **1 file changed** (+0 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/routers/knowledge.py` (+0 -1) </details> ### 📄 Description ## Summary `process_files_batch()` does not accept a `db` keyword argument, but `add_files_to_knowledge_batch` passes `db=db` when calling it, which raises a `TypeError` at runtime. **Root cause:** The function signature in `routers/retrieval.py` intentionally omits `db` because it makes long-running external embedding API calls (5–60+ seconds) and manages its own short-lived DB sessions internally. **Fix:** Remove the `db=db` line from the call in `knowledge.py`. Fixes #23137 ## Change ```python # Before result = await process_files_batch( request=request, form_data=BatchProcessFilesForm(files=files, collection_name=id), user=user, db=db, # ← TypeError: unexpected keyword argument ) # After result = await process_files_batch( request=request, form_data=BatchProcessFilesForm(files=files, collection_name=id), user=user, ) ``` ## Test plan - [ ] Call `POST /api/v1/knowledge/{id}/files/batch` with a valid collection — should no longer raise `TypeError: process_files_batch() got an unexpected keyword argument 'db'` - [ ] Verify files are still processed and added to the knowledge collection correctly --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-20 06:52:21 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#27099