issue: elasticsearch.BadRequestError: BadRequestError(400, 'None') #5612

Closed
opened 2025-11-11 16:26:18 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @bulolo on GitHub (Jun 22, 2025).

Originally assigned to: @jackthgu on GitHub.

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.15

Ollama Version (if applicable)

No response

Operating System

helm ,linux

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

success to upload file and use es

Actual Behavior

error when with es

Steps to Reproduce

install by helm and set VECTOR_DB to elasticsearch

extraEnvVars:
  - name: VECTOR_DB
    value: "elasticsearch"
  - name: ELASTICSEARCH_API_KEY
    value: "S0wxTGxwY0JXTDMzWE02RUJoQkc6WUozWXJ2UndSdUNPTzVLNzhiLXh5Zw=="
  - name: ELASTICSEARCH_URL
    value: "http://192.168.3.163:9200"

Logs & Screenshots

elasticsearch.BadRequestError: BadRequestError(400, 'None')
2025-06-22 05:59:35.610 | ERROR    | open_webui.routers.retrieval:process_file:1457 - BadRequestError(400, 'None') - {}
Traceback (most recent call last):

  File "/usr/local/lib/python3.11/threading.py", line 1002, in _bootstrap
    self._bootstrap_inner()
    │    └ <function Thread._bootstrap_inner at 0x7f1109e149a0>
    └ <WorkerThread(AnyIO worker thread, started 139709361661632)>
  File "/usr/local/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
    self.run()
    │    └ <function WorkerThread.run at 0x7f10a352c0e0>
    └ <WorkerThread(AnyIO worker thread, started 139709361661632)>
  File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 967, in run
    result = context.run(func, *args)
             │       │   │      └ ()
             │       │   └ functools.partial(<function add_file_to_knowledge_by_id at 0x7f10a8ce4ae0>, user=UserModel(id='316961bb-f424-4a18-afb3-ac0515...
             │       └ <method 'run' of '_contextvars.Context' objects>
             └ <_contextvars.Context object at 0x7f10a3107e80>

  File "/app/backend/open_webui/routers/knowledge.py", line 372, in add_file_to_knowledge_by_id
    process_file(
    └ <function process_file at 0x7f10a8f8b7e0>

> File "/app/backend/open_webui/routers/retrieval.py", line 1447, in process_file
    raise e
          └ BadRequestError('None', meta=ApiResponseMeta(status=400, http_version='1.1', headers={'X-elastic-product': 'Elasticsearch', '...

  File "/app/backend/open_webui/routers/retrieval.py", line 1419, in process_file
    result = save_docs_to_vector_db(
             └ <function save_docs_to_vector_db at 0x7f10a8f8b4c0>

  File "/app/backend/open_webui/routers/retrieval.py", line 1263, in save_docs_to_vector_db
    raise e

  File "/app/backend/open_webui/routers/retrieval.py", line 1255, in save_docs_to_vector_db
    VECTOR_DB_CLIENT.insert(
    │                └ <function ElasticsearchClient.insert at 0x7f10b1004c20>
    └ <open_webui.retrieval.vector.dbs.elasticsearch.ElasticsearchClient object at 0x7f10b71a0f10>

  File "/app/backend/open_webui/retrieval/vector/dbs/elasticsearch.py", line 234, in insert
    if not self._has_index(dimension=len(items[0]["vector"])):
           │    │                        └ [{'id': '1ff5427e-2280-4aa9-82aa-4d0d6bd0075a', 'text': "为进一步制造或实验室使用\nREV:C/1 1/3GMP内切酶BsaⅠ说明书\nCat#:8052621\n【产品名称】\nGMP内切酶...
           │    └ <function ElasticsearchClient._has_index at 0x7f10b1004a40>
           └ <open_webui.retrieval.vector.dbs.elasticsearch.ElasticsearchClient object at 0x7f10b71a0f10>

  File "/app/backend/open_webui/retrieval/vector/dbs/elasticsearch.py", line 213, in _has_index
    return self.client.indices.exists(
           │    │      │       └ <function IndicesClient.exists at 0x7f10b22e8ae0>
           │    │      └ <elasticsearch._sync.client.indices.IndicesClient object at 0x7f10b71d01d0>
           │    └ <Elasticsearch(['http://192.168.3.163:9200'])>
           └ <open_webui.retrieval.vector.dbs.elasticsearch.ElasticsearchClient object at 0x7f10b71a0f10>

  File "/usr/local/lib/python3.11/site-packages/elasticsearch/_sync/client/utils.py", line 415, in wrapped
    return api(*args, **kwargs)
           │    │       └ {'index': 'open_webui_collections_d1024'}
           │    └ (<elasticsearch._sync.client.indices.IndicesClient object at 0x7f10b71d01d0>,)
           └ <function IndicesClient.exists at 0x7f10b22e8a40>
  File "/usr/local/lib/python3.11/site-packages/elasticsearch/_sync/client/indices.py", line 1523, in exists
    return self.perform_request(  # type: ignore[return-value]
           │    └ <function NamespacedClient.perform_request at 0x7f10b6e17560>
           └ <elasticsearch._sync.client.indices.IndicesClient object at 0x7f10b71d01d0>
  File "/usr/local/lib/python3.11/site-packages/elasticsearch/_sync/client/_base.py", line 422, in perform_request
    return self._client.perform_request(
           │    │       └ <function BaseClient.perform_request at 0x7f10b6e17380>
           │    └ <Elasticsearch(['http://192.168.3.163:9200'])>
           └ <elasticsearch._sync.client.indices.IndicesClient object at 0x7f10b71d01d0>
  File "/usr/local/lib/python3.11/site-packages/elasticsearch/_sync/client/_base.py", line 271, in perform_request
    response = self._perform_request(
               │    └ <function BaseClient._perform_request at 0x7f10b6e17420>
               └ <Elasticsearch(['http://192.168.3.163:9200'])>
  File "/usr/local/lib/python3.11/site-packages/elasticsearch/_sync/client/_base.py", line 351, in _perform_request
    raise HTTP_EXCEPTIONS.get(meta.status, ApiError)(
          │               │   │    │       └ <class 'elasticsearch.ApiError'>
          │               │   │    └ 400
          │               │   └ ApiResponseMeta(status=400, http_version='1.1', headers={'X-elastic-product': 'Elasticsearch', 'content-type': 'application/j...
          │               └ <method 'get' of 'dict' objects>
          └ {400: <class 'elasticsearch.BadRequestError'>, 401: <class 'elasticsearch.AuthenticationException'>, 403: <class 'elasticsear...

elasticsearch.BadRequestError: BadRequestError(400, 'None')

Additional Information

{
"name": "es0",
"cluster_name": "es-cluster",
"cluster_uuid": "EePmcg7mRgygE5chieKrFQ",
"version": {
"number": "8.14.3",
"build_flavor": "default",
"build_type": "docker",
"build_hash": "d55f984299e0e88dee72ebd8255f7ff130859ad0",
"build_date": "2024-07-07T22:04:49.882652950Z",
"build_snapshot": false,
"lucene_version": "9.10.0",
"minimum_wire_compatibility_version": "7.17.0",
"minimum_index_compatibility_version": "7.0.0"
},
"tagline": "You Know, for Search"
}
Originally created by @bulolo on GitHub (Jun 22, 2025). Originally assigned to: @jackthgu on GitHub. ### 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.15 ### Ollama Version (if applicable) _No response_ ### Operating System helm ,linux ### 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 success to upload file and use es ### Actual Behavior error when with es ### Steps to Reproduce install by helm and set VECTOR_DB to elasticsearch ``` extraEnvVars: - name: VECTOR_DB value: "elasticsearch" - name: ELASTICSEARCH_API_KEY value: "S0wxTGxwY0JXTDMzWE02RUJoQkc6WUozWXJ2UndSdUNPTzVLNzhiLXh5Zw==" - name: ELASTICSEARCH_URL value: "http://192.168.3.163:9200" ``` ### Logs & Screenshots ``` elasticsearch.BadRequestError: BadRequestError(400, 'None') 2025-06-22 05:59:35.610 | ERROR  | open_webui.routers.retrieval:process_file:1457 - BadRequestError(400, 'None') - {} Traceback (most recent call last): File "/usr/local/lib/python3.11/threading.py", line 1002, in _bootstrap self._bootstrap_inner() │ └ <function Thread._bootstrap_inner at 0x7f1109e149a0> └ <WorkerThread(AnyIO worker thread, started 139709361661632)> File "/usr/local/lib/python3.11/threading.py", line 1045, in _bootstrap_inner self.run() │ └ <function WorkerThread.run at 0x7f10a352c0e0> └ <WorkerThread(AnyIO worker thread, started 139709361661632)> File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 967, in run result = context.run(func, *args) │ │ │ └ () │ │ └ functools.partial(<function add_file_to_knowledge_by_id at 0x7f10a8ce4ae0>, user=UserModel(id='316961bb-f424-4a18-afb3-ac0515... │ └ <method 'run' of '_contextvars.Context' objects> └ <_contextvars.Context object at 0x7f10a3107e80> File "/app/backend/open_webui/routers/knowledge.py", line 372, in add_file_to_knowledge_by_id process_file( └ <function process_file at 0x7f10a8f8b7e0> > File "/app/backend/open_webui/routers/retrieval.py", line 1447, in process_file raise e  └ BadRequestError('None', meta=ApiResponseMeta(status=400, http_version='1.1', headers={'X-elastic-product': 'Elasticsearch', '... File "/app/backend/open_webui/routers/retrieval.py", line 1419, in process_file result = save_docs_to_vector_db(  └ <function save_docs_to_vector_db at 0x7f10a8f8b4c0> File "/app/backend/open_webui/routers/retrieval.py", line 1263, in save_docs_to_vector_db raise e File "/app/backend/open_webui/routers/retrieval.py", line 1255, in save_docs_to_vector_db VECTOR_DB_CLIENT.insert( │ └ <function ElasticsearchClient.insert at 0x7f10b1004c20> └ <open_webui.retrieval.vector.dbs.elasticsearch.ElasticsearchClient object at 0x7f10b71a0f10> File "/app/backend/open_webui/retrieval/vector/dbs/elasticsearch.py", line 234, in insert if not self._has_index(dimension=len(items[0]["vector"])):  │ │ └ [{'id': '1ff5427e-2280-4aa9-82aa-4d0d6bd0075a', 'text': "为进一步制造或实验室使用\nREV:C/1 1/3GMP内切酶BsaⅠ说明书\nCat#:8052621\n【产品名称】\nGMP内切酶...  │ └ <function ElasticsearchClient._has_index at 0x7f10b1004a40>  └ <open_webui.retrieval.vector.dbs.elasticsearch.ElasticsearchClient object at 0x7f10b71a0f10> File "/app/backend/open_webui/retrieval/vector/dbs/elasticsearch.py", line 213, in _has_index return self.client.indices.exists(  │ │ │ └ <function IndicesClient.exists at 0x7f10b22e8ae0>  │ │ └ <elasticsearch._sync.client.indices.IndicesClient object at 0x7f10b71d01d0>  │ └ <Elasticsearch(['http://192.168.3.163:9200'])>  └ <open_webui.retrieval.vector.dbs.elasticsearch.ElasticsearchClient object at 0x7f10b71a0f10> File "/usr/local/lib/python3.11/site-packages/elasticsearch/_sync/client/utils.py", line 415, in wrapped return api(*args, **kwargs) │ │ └ {'index': 'open_webui_collections_d1024'} │ └ (<elasticsearch._sync.client.indices.IndicesClient object at 0x7f10b71d01d0>,) └ <function IndicesClient.exists at 0x7f10b22e8a40> File "/usr/local/lib/python3.11/site-packages/elasticsearch/_sync/client/indices.py", line 1523, in exists return self.perform_request( # type: ignore[return-value] │ └ <function NamespacedClient.perform_request at 0x7f10b6e17560> └ <elasticsearch._sync.client.indices.IndicesClient object at 0x7f10b71d01d0> File "/usr/local/lib/python3.11/site-packages/elasticsearch/_sync/client/_base.py", line 422, in perform_request return self._client.perform_request( │ │ └ <function BaseClient.perform_request at 0x7f10b6e17380> │ └ <Elasticsearch(['http://192.168.3.163:9200'])> └ <elasticsearch._sync.client.indices.IndicesClient object at 0x7f10b71d01d0> File "/usr/local/lib/python3.11/site-packages/elasticsearch/_sync/client/_base.py", line 271, in perform_request response = self._perform_request( │ └ <function BaseClient._perform_request at 0x7f10b6e17420> └ <Elasticsearch(['http://192.168.3.163:9200'])> File "/usr/local/lib/python3.11/site-packages/elasticsearch/_sync/client/_base.py", line 351, in _perform_request raise HTTP_EXCEPTIONS.get(meta.status, ApiError)( │ │ │ │ └ <class 'elasticsearch.ApiError'> │ │ │ └ 400 │ │ └ ApiResponseMeta(status=400, http_version='1.1', headers={'X-elastic-product': 'Elasticsearch', 'content-type': 'application/j... │ └ <method 'get' of 'dict' objects> └ {400: <class 'elasticsearch.BadRequestError'>, 401: <class 'elasticsearch.AuthenticationException'>, 403: <class 'elasticsear... elasticsearch.BadRequestError: BadRequestError(400, 'None') ``` ### Additional Information ``` { "name": "es0", "cluster_name": "es-cluster", "cluster_uuid": "EePmcg7mRgygE5chieKrFQ", "version": { "number": "8.14.3", "build_flavor": "default", "build_type": "docker", "build_hash": "d55f984299e0e88dee72ebd8255f7ff130859ad0", "build_date": "2024-07-07T22:04:49.882652950Z", "build_snapshot": false, "lucene_version": "9.10.0", "minimum_wire_compatibility_version": "7.17.0", "minimum_index_compatibility_version": "7.0.0" }, "tagline": "You Know, for Search" } ```
GiteaMirror added the bug label 2025-11-11 16:26:18 -06:00
Author
Owner

@jackthgu commented on GitHub (Jun 29, 2025):

Hello, @bulolo

Currently, the ElasticSearch version used by open webui is 0.9.1.
To support your desired ElasticSearch version,
you will need to perform the following dependency replacements:

pip uninstall elasticsearch elastic-transport -y
pip install "elastic-transport>=8,<9" "elasticsearch>=8.14,<9"

Please note that the Elasticsearch Python client version 9.x does not yet support the compatibility_mode=True option.
I'm not aware of an automatic way to switch the header to version 8.
It might be helpful to consider implementing error messages that account for version mismatches between the Elasticsearch client and the engine. @tjbck

Please make sure to test this and leave a reply indicating whether it was successful or if you encountered issues. This helps with issue management.

Thank you for your valuable testing.
Jack.

@jackthgu commented on GitHub (Jun 29, 2025): Hello, @bulolo Currently, the ElasticSearch version used by open webui is 0.9.1. To support your desired ElasticSearch version, you will need to perform the following dependency replacements: ```bash pip uninstall elasticsearch elastic-transport -y pip install "elastic-transport>=8,<9" "elasticsearch>=8.14,<9" ``` Please note that the Elasticsearch Python client version 9.x does not yet support the compatibility_mode=True option. I'm not aware of an automatic way to switch the header to version 8. It might be helpful to consider implementing error messages that account for version mismatches between the Elasticsearch client and the engine. @tjbck Please make sure to test this and leave a reply indicating whether it was successful or if you encountered issues. This helps with issue management. Thank you for your valuable testing. Jack.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#5612