rerank error [models] Bad Request Error, The read operation timed out #12760

Closed
opened 2026-02-21 19:08:54 -05:00 by yindo · 2 comments
Owner

Originally created by @shengxianli on GitHub (Apr 10, 2025).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.13

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

core.model_runtime.errors.invoke.InvokeBadRequestError: [models] Bad Request Error, The read operation timed out
Exception in thread Thread-363 (_retriever):
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/threading.py", line 1075, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.12/threading.py", line 1012, in run
    self._target(*self._args, **self._kwargs)
  File "/app/api/core/rag/retrieval/dataset_retrieval.py", line 624, in _retriever
    documents = RetrievalService.retrieve(
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/core/rag/datasource/retrieval_service.py", line 112, in retrieve
    all_documents = data_post_processor.invoke(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/core/rag/data_post_processor/data_post_processor.py", line 37, in invoke
    documents = self.rerank_runner.run(query, documents, score_threshold, top_n, user)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/core/rag/rerank/rerank_model.py", line 48, in run
    rerank_result = self.rerank_model_instance.invoke_rerank(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/core/model_manager.py", line 276, in invoke_rerank
    self._round_robin_invoke(
  File "/app/api/core/model_manager.py", line 370, in _round_robin_invoke
    return function(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/core/model_runtime/model_providers/__base/rerank_model.py", line 53, in invoke
    raise self._transform_invoke_error(e)
  File "/app/api/core/model_runtime/model_providers/__base/rerank_model.py", line 40, in invoke
    return plugin_model_manager.invoke_rerank(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/core/plugin/manager/model.py", line 359, in invoke_rerank
    for resp in response:
                ^^^^^^^^
  File "/app/api/core/plugin/manager/base.py", line 189, in _request_with_plugin_daemon_response_stream
    self._handle_plugin_daemon_error(error.error_type, error.message)
  File "/app/api/core/plugin/manager/base.py", line 213, in _handle_plugin_daemon_error
    raise InvokeBadRequestError(description=args.get("description"))
core.model_runtime.errors.invoke.InvokeBadRequestError: [models] Bad Request Error, The read operation timed out

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @shengxianli on GitHub (Apr 10, 2025). ### Self Checks - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.13 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce ``` core.model_runtime.errors.invoke.InvokeBadRequestError: [models] Bad Request Error, The read operation timed out Exception in thread Thread-363 (_retriever): Traceback (most recent call last): File "/usr/local/lib/python3.12/threading.py", line 1075, in _bootstrap_inner self.run() File "/usr/local/lib/python3.12/threading.py", line 1012, in run self._target(*self._args, **self._kwargs) File "/app/api/core/rag/retrieval/dataset_retrieval.py", line 624, in _retriever documents = RetrievalService.retrieve( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/rag/datasource/retrieval_service.py", line 112, in retrieve all_documents = data_post_processor.invoke( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/rag/data_post_processor/data_post_processor.py", line 37, in invoke documents = self.rerank_runner.run(query, documents, score_threshold, top_n, user) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/rag/rerank/rerank_model.py", line 48, in run rerank_result = self.rerank_model_instance.invoke_rerank( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/model_manager.py", line 276, in invoke_rerank self._round_robin_invoke( File "/app/api/core/model_manager.py", line 370, in _round_robin_invoke return function(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/model_runtime/model_providers/__base/rerank_model.py", line 53, in invoke raise self._transform_invoke_error(e) File "/app/api/core/model_runtime/model_providers/__base/rerank_model.py", line 40, in invoke return plugin_model_manager.invoke_rerank( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/plugin/manager/model.py", line 359, in invoke_rerank for resp in response: ^^^^^^^^ File "/app/api/core/plugin/manager/base.py", line 189, in _request_with_plugin_daemon_response_stream self._handle_plugin_daemon_error(error.error_type, error.message) File "/app/api/core/plugin/manager/base.py", line 213, in _handle_plugin_daemon_error raise InvokeBadRequestError(description=args.get("description")) core.model_runtime.errors.invoke.InvokeBadRequestError: [models] Bad Request Error, The read operation timed out ``` ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo added the 🤔 cant-reproduce label 2026-02-21 19:08:54 -05:00
yindo closed this issue 2026-02-21 19:08:54 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Apr 10, 2025):

The "Bad Request Error, The read operation timed out" in the rerank process when self-hosted with Docker could be due to a hardcoded timeout setting in the model provider integration code. To resolve this issue, you may need to modify the relevant Python file in the api/core/model_runtime/model_providers/gpustack directory that contains the hardcoded timeout value [1].

Additionally, you might want to check the Docker setup configurations that can affect timeout behavior. For instance, the PYTHON_ENV_INIT_TIMEOUT environment variable in the docker-compose.yaml file controls the timeout for plugin dependency installation. You can increase this timeout if needed. Also, ensure that your Docker configuration includes the necessary volume mappings and updates to the config.yaml file to handle allowed syscalls [2][3].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@dosubot[bot] commented on GitHub (Apr 10, 2025): <!-- Answer --> The "Bad Request Error, The read operation timed out" in the rerank process when self-hosted with Docker could be due to a hardcoded timeout setting in the model provider integration code. To resolve this issue, you may need to modify the relevant Python file in the `api/core/model_runtime/model_providers/gpustack` directory that contains the hardcoded timeout value <sup>[[1]](https://github.com/langgenius/dify/issues/14181)</sup>. Additionally, you might want to check the Docker setup configurations that can affect timeout behavior. For instance, the `PYTHON_ENV_INIT_TIMEOUT` environment variable in the `docker-compose.yaml` file controls the timeout for plugin dependency installation. You can increase this timeout if needed. Also, ensure that your Docker configuration includes the necessary volume mappings and updates to the `config.yaml` file to handle allowed syscalls <sup>[[2]](https://github.com/langgenius/dify/issues/15600)</sup><sup>[[3]](https://github.com/langgenius/dify/issues/15817)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/f576ca3e-f442-4d61-90ee-c5f6c40a8ac2?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/f576ca3e-f442-4d61-90ee-c5f6c40a8ac2?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/f576ca3e-f442-4d61-90ee-c5f6c40a8ac2?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/f576ca3e-f442-4d61-90ee-c5f6c40a8ac2?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/f576ca3e-f442-4d61-90ee-c5f6c40a8ac2?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/f576ca3e-f442-4d61-90ee-c5f6c40a8ac2?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/f576ca3e-f442-4d61-90ee-c5f6c40a8ac2?feedback_type=other)</sup>
Author
Owner

@shengxianli commented on GitHub (Apr 10, 2025):

使用 Docker 自托管时,重新排名过程中出现“错误请求错误,读取操作超时”错误,可能是由于模型提供程序集成代码中的硬编码超时设置造成的。要解决此问题,您可能需要修改api/core/model_runtime/model_providers/gpustack包含硬编码超时值[1]的目录中的相关 Python 文件。

此外,您可能需要检查可能影响超时行为的 Docker 设置配置。例如,文件PYTHON_ENV_INIT_TIMEOUT中的环境变量docker-compose.yaml控制插件依赖项安装的超时时间。您可以根据需要增加此超时时间。此外,请确保您的 Docker 配置包含必要的卷映射和文件更新,config.yaml以处理允许的系统调用[2] [3]

要继续与Dosu交谈,请提及@dosu

帮助 Dosu 学习!提供反馈:精彩回复|不相关的答案|来源错误|内容过于冗长|幻觉|错误报告|其他

There is no gpustack directory

root@IT-AI-01:~/dify/api/core/model_runtime/model_providers# ll
total 32
drwxr-xr-x 3 root root 4096 Apr 10 21:59 ./
drwxr-xr-x 9 root root 4096 Apr 8 11:10 ../
drwxr-xr-x 3 root root 4096 Apr 10 22:08 __base/
-rw-r--r-- 1 root root 0 Mar 19 10:52 __init__.py
-rw-r--r-- 1 root root 15533 Mar 19 10:52 model_provider_factory.py
-rw-r--r-- 1 root root 492 Mar 19 10:52 _position.yaml

@shengxianli commented on GitHub (Apr 10, 2025): > 使用 Docker 自托管时,重新排名过程中出现“错误请求错误,读取操作超时”错误,可能是由于模型提供程序集成代码中的硬编码超时设置造成的。要解决此问题,您可能需要修改`api/core/model_runtime/model_providers/gpustack`包含硬编码超时值[[1]](https://github.com/langgenius/dify/issues/14181)的目录中的相关 Python 文件。 > > 此外,您可能需要检查可能影响超时行为的 Docker 设置配置。例如,文件`PYTHON_ENV_INIT_TIMEOUT`中的环境变量`docker-compose.yaml`控制插件依赖项安装的超时时间。您可以根据需要增加此超时时间。此外,请确保您的 Docker 配置包含必要的卷映射和文件更新,`config.yaml`以处理允许的系统调用[[2] ](https://github.com/langgenius/dify/issues/15600)[[3]](https://github.com/langgenius/dify/issues/15817)。 > > _要继续与[Dosu](https://dosu.dev)交谈,请提及[@dosu](https://github.com/dosu)。_ > > 帮助 Dosu 学习!提供反馈:[精彩回复](https://app.dosu.dev/response-feedback/f576ca3e-f442-4d61-90ee-c5f6c40a8ac2?feedback_type=great_response)|[不相关的答案](https://app.dosu.dev/response-feedback/f576ca3e-f442-4d61-90ee-c5f6c40a8ac2?feedback_type=irrelevant_answer)|[来源错误](https://app.dosu.dev/response-feedback/f576ca3e-f442-4d61-90ee-c5f6c40a8ac2?feedback_type=incorrect_sources)|[内容过于冗长](https://app.dosu.dev/response-feedback/f576ca3e-f442-4d61-90ee-c5f6c40a8ac2?feedback_type=too_verbose)|[幻觉](https://app.dosu.dev/response-feedback/f576ca3e-f442-4d61-90ee-c5f6c40a8ac2?feedback_type=hallucination)|[错误报告](https://app.dosu.dev/response-feedback/f576ca3e-f442-4d61-90ee-c5f6c40a8ac2?feedback_type=bug_report)|[其他](https://app.dosu.dev/response-feedback/f576ca3e-f442-4d61-90ee-c5f6c40a8ac2?feedback_type=other) There is no gpustack directory root@IT-AI-01:~/dify/api/core/model_runtime/model_providers# ll total 32 drwxr-xr-x 3 root root 4096 Apr 10 21:59 ./ drwxr-xr-x 9 root root 4096 Apr 8 11:10 ../ drwxr-xr-x 3 root root 4096 Apr 10 22:08 __base/ -rw-r--r-- 1 root root 0 Mar 19 10:52 __init__.py -rw-r--r-- 1 root root 15533 Mar 19 10:52 model_provider_factory.py -rw-r--r-- 1 root root 492 Mar 19 10:52 _position.yaml
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#12760