Skip to content

issue: IndicesClient.refresh() TypeError with opensearch-py >= 3.0.0 #20649

@scy11a

Description

@scy11a

Check Existing Issues

  • I have searched for any existing and/or related issues.
  • I have searched for any existing and/or related discussions.
  • I have also searched in the CLOSED issues AND CLOSED discussions and found no related items (your issue might already be addressed on the development branch!).
  • I am using the latest version of Open WebUI.

Installation Method

Docker

Open WebUI Version

0.7.2

Ollama Version (if applicable)

No response

Operating System

Debian 12

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

Document should be successfully add to a knowledge using OpenSearch database.

Actual Behavior

File upload fails with TypeError in save_docs_to_vector_db() function when VECTOR_DB_CLIENT.insert() is called. Because of this it is impossible to add a document to a knowledge with OpenSearch backend.

Steps to Reproduce

  1. Deploy Open-WebUI with OpenSearch as vector database backend
  2. Configure vector database to use OpenSearch cluster
  3. Create a knowledge
  4. Upload a document/file via the Web UI
  5. Observe the error in the logs during embedding and indexing

Logs & Screenshots

open-webui | 2026-01-13 19:15:13.436 | ERROR | open_webui.routers.retrieval:process_file:1792 - IndicesClient.refresh() takes 1 positional argument but 2 positional arguments (and 2 keyword-only arguments) were given
open-webui | Traceback (most recent call last):
open-webui |
open-webui | File "/usr/local/lib/python3.11/threading.py", line 1002, in _bootstrap
open-webui | self._bootstrap_inner()
open-webui | │ └ <function Thread._bootstrap_inner at 0x7633a17554e0>
open-webui | └ <WorkerThread(AnyIO worker thread, started 129962262644416)>
open-webui | File "/usr/local/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
open-webui | self.run()
open-webui | │ └ <function WorkerThread.run at 0x763339d9da80>
open-webui | └ <WorkerThread(AnyIO worker thread, started 129962262644416)>
open-webui | File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 986, in run
open-webui | result = context.run(func, *args)
open-webui | │ │ │ └ ()
open-webui | │ │ └ functools.partial(<function process_uploaded_file at 0x76333d6ad9e0>, <starlette.requests.Request object at 0x7633302eee50>, ...
open-webui | │ └ <method 'run' of '_contextvars.Context' objects>
open-webui | └ <_contextvars.Context object at 0x76333059d180>
open-webui |
open-webui | File "/app/backend/open_webui/routers/files.py", line 189, in process_uploaded_file
open-webui | _process_handler(db_session)
open-webui | │ └ <sqlalchemy.orm.session.Session object at 0x763331cd1f10>
open-webui | └ <function process_uploaded_file.._process_handler at 0x763339e13a60>
open-webui |
open-webui | File "/app/backend/open_webui/routers/files.py", line 153, in _process_handler
open-webui | process_file(
open-webui | └ <function process_file at 0x76333d6ad260>
open-webui |
open-webui | > File "/app/backend/open_webui/routers/retrieval.py", line 1789, in process_file
open-webui | raise e
open-webui | └ TypeError('IndicesClient.refresh() takes 1 positional argument but 2 positional arguments (and 2 keyword-only arguments) were...
open-webui |
open-webui | File "/app/backend/open_webui/routers/retrieval.py", line 1750, in process_file
open-webui | result = save_docs_to_vector_db(
open-webui | └ <function save_docs_to_vector_db at 0x76333d6ad080>
open-webui |
open-webui | File "/app/backend/open_webui/routers/retrieval.py", line 1571, in save_docs_to_vector_db
open-webui | raise e
open-webui |
open-webui | File "/app/backend/open_webui/routers/retrieval.py", line 1562, in save_docs_to_vector_db
open-webui | VECTOR_DB_CLIENT.insert(
open-webui | │ └ <function OpenSearchClient.insert at 0x76336e674cc0>
open-webui | └ <open_webui.retrieval.vector.dbs.opensearch.OpenSearchClient object at 0x76336e8fdb90>
open-webui |
open-webui | File "/app/backend/open_webui/retrieval/vector/dbs/opensearch.py", line 214, in insert
open-webui | self.client.indices.refresh(self._get_index_name(collection_name))
open-webui | │ │ │ │ │ │ └ 'file-d6928264-f421-42b7-8fa3-df84dc3632fa'
open-webui | │ │ │ │ │ └ <function OpenSearchClient._get_index_name at 0x76336e6bf2e0>
open-webui | │ │ │ │ └ <open_webui.retrieval.vector.dbs.opensearch.OpenSearchClient object at 0x76336e8fdb90>
open-webui | │ │ │ └ <function IndicesClient.refresh at 0x76336e7aa340>
open-webui | │ │ └ <opensearchpy.client.indices.IndicesClient object at 0x76336e47c290>
open-webui | │ └ <OpenSearch([{'host': '10.111.111.63', 'port': 9200}])>
open-webui | └ <open_webui.retrieval.vector.dbs.opensearch.OpenSearchClient object at 0x76336e8fdb90>
open-webui |
open-webui | File "/usr/local/lib/python3.11/site-packages/opensearchpy/client/utils.py", line 176, in _wrapped
open-webui | return func(*args, params=params, headers=headers, **kwargs)
open-webui | │ │ │ │ └ {}
open-webui | │ │ │ └ {}
open-webui | │ │ └ {}
open-webui | │ └ (<opensearchpy.client.indices.IndicesClient object at 0x76336e47c290>, 'open_webui_file-d6928264-f421-42b7-8fa3-df84dc3632fa')
open-webui | └ <function IndicesClient.refresh at 0x76336e7aa2a0>
open-webui |
open-webui | TypeError: IndicesClient.refresh() takes 1 positional argument but 2 positional arguments (and 2 keyword-only arguments) were given
open-webui | 2026-01-13 19:15:13.445 | ERROR | open_webui.routers.files:_process_handler:175 - Error processing file: d6928264-f421-42b7-8fa3-df84dc3632fa

Additional Information

The probable Root Cause
In opensearch-py >= 3.0.0, the IndicesClient.refresh() method signature changed to accept only keyword-only arguments. However, the code in open_webui/retrieval/vector/dbs/opensearch.py (line 214) calls this method with a positional argument:

Possible solution (after this modification I was able to upload a file):

Current (broken) code:

self.client.indices.refresh(self._get_index_name(collection_name))

Expected (working) code:

self.client.indices.refresh(index=self._get_index_name(collection_name))

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions