Run failed: [openai_api_compatible] Error: PluginInvokeError: {"args":{},"error_type":"ConnectionError","message":"HTTPConnectionPool(host='10.18.121.47', port=1234): Read timed out."} #643

Closed
opened 2026-02-16 10:20:02 -05:00 by yindo · 14 comments
Owner

Originally created by @shihuimin1012 on GitHub (Sep 12, 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 Dify issues & Dify Official Plugins, 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.2.0

Plugin version

1.2.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

使用lm studio配置模型会出缺少mode 问题,使用OpenAI-API-compatible 配置模型会time out

不管修改什么env参数,依旧使用会报错time out 300

不知道这个300是写死了还是这样?哪里有更新

请问难道使用本地模型,慢点返回就不能用了?无数人提了这个问题都没有解决

✔️ Error log

Run failed: [openai_api_compatible] Error: PluginInvokeError: {"args":{},"error_type":"ConnectionError","message":"HTTPConnectionPool(host='10.18.121.47', port=1234): Read timed out."}

Originally created by @shihuimin1012 on GitHub (Sep 12, 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 [Dify issues](https://github.com/langgenius/dify/issues) & [Dify Official Plugins](https://github.com/langgenius/dify-official-plugins/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.2.0 ### Plugin version 1.2.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce 使用lm studio配置模型会出缺少mode 问题,使用OpenAI-API-compatible 配置模型会time out 不管修改什么env参数,依旧使用会报错time out 300 不知道这个300是写死了还是这样?哪里有更新 请问难道使用本地模型,慢点返回就不能用了?无数人提了这个问题都没有解决 ### ✔️ Error log Run failed: [openai_api_compatible] Error: PluginInvokeError: {"args":{},"error_type":"ConnectionError","message":"HTTPConnectionPool(host='10.18.121.47', port=1234): Read timed out."}
yindo added the bug label 2026-02-16 10:20:02 -05:00
yindo closed this issue 2026-02-16 10:20:02 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Sep 12, 2025):

The 300-second timeout for OpenAI-API-compatible plugins in Dify 1.2.0 is hardcoded in the backend code (api/core/model_runtime/model_providers/openai_api_compatible/model.py) and cannot be changed via environment variables or configuration files. To increase this timeout, you would need to modify the code directly and rebuild your Docker image, which can be complex to maintain across upgrades. This limitation means that if your local model takes longer than 300 seconds to respond, Dify will always time out, regardless of any .env changes or Docker settings [source 1].

For the "missing mode" error with LM Studio or similar models, you need to add a mode field under model_properties in your model YAML config. For example:

model_properties:
  mode: chat  # or 'complete' for text completion models
  context_size: 200000

This field is required for all LLM integrations, including OpenAI-API-compatible and LM Studio models [source 2].

Timeout issues with local models are also commonly caused by Docker network misconfiguration (e.g., using localhost instead of your host's LAN IP or host.docker.internal), missing environment variables like SANDBOX_ENABLE_NETWORK=true, or reverse proxy timeouts. Make sure your Dify container can reach your model endpoint and check for any network/firewall issues [source 3].

Recent Dify versions (after 1.7.1) have added configurable timeouts for MCP providers, but this does not apply to OpenAI-API-compatible plugins yet [source 4].

If you need longer timeouts for local models, your options are to patch the code, try running Dify outside Docker to rule out network issues, or consider using a different provider type if your use case allows.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

@dosubot[bot] commented on GitHub (Sep 12, 2025): <!-- Answer --> The 300-second timeout for OpenAI-API-compatible plugins in Dify 1.2.0 is hardcoded in the backend code (`api/core/model_runtime/model_providers/openai_api_compatible/model.py`) and cannot be changed via environment variables or configuration files. To increase this timeout, you would need to modify the code directly and rebuild your Docker image, which can be complex to maintain across upgrades. This limitation means that if your local model takes longer than 300 seconds to respond, Dify will always time out, regardless of any .env changes or Docker settings [[source 1]](https://github.com/langgenius/dify-official-plugins/issues/936). For the "missing mode" error with LM Studio or similar models, you need to add a `mode` field under `model_properties` in your model YAML config. For example: ```yaml model_properties: mode: chat # or 'complete' for text completion models context_size: 200000 ``` This field is required for all LLM integrations, including OpenAI-API-compatible and LM Studio models [[source 2]](https://github.com/langgenius/dify/blob/285291f54527a0e3d2a57c71e1f9a9c2b3f60455/api/core/model_runtime/docs/en_US/predefined_model_scale_out.md). Timeout issues with local models are also commonly caused by Docker network misconfiguration (e.g., using `localhost` instead of your host's LAN IP or `host.docker.internal`), missing environment variables like `SANDBOX_ENABLE_NETWORK=true`, or reverse proxy timeouts. Make sure your Dify container can reach your model endpoint and check for any network/firewall issues [[source 3]](https://github.com/langgenius/dify-official-plugins/issues/1019). Recent Dify versions (after 1.7.1) have added configurable timeouts for MCP providers, but this does not apply to OpenAI-API-compatible plugins yet [[source 4]](https://github.com/langgenius/dify/pull/23605). If you need longer timeouts for local models, your options are to patch the code, try running Dify outside Docker to rule out network issues, or consider using a different provider type if your use case allows. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/d2d31160-1ffc-4e63-afea-fcf69563a5c3?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/d2d31160-1ffc-4e63-afea-fcf69563a5c3?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/d2d31160-1ffc-4e63-afea-fcf69563a5c3?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/d2d31160-1ffc-4e63-afea-fcf69563a5c3?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/d2d31160-1ffc-4e63-afea-fcf69563a5c3?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/d2d31160-1ffc-4e63-afea-fcf69563a5c3?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/d2d31160-1ffc-4e63-afea-fcf69563a5c3?feedback_type=other)</sup>&nbsp;&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify-official-plugins/issues/1705)
Author
Owner

@shihuimin1012 commented on GitHub (Sep 12, 2025):

不太明白 为什么不在升级时候把这个300s参数改为可配置得配置文件呢

@shihuimin1012 commented on GitHub (Sep 12, 2025): 不太明白 为什么不在升级时候把这个300s参数改为可配置得配置文件呢
Author
Owner

@dosubot[bot] commented on GitHub (Sep 12, 2025):

目前 Dify 的 OpenAI-API-compatible 插件(比如你遇到的 300 秒超时问题)确实是把超时时间硬编码在插件代码里的,并没有通过配置文件或环境变量暴露出来让用户自定义。比如在 common_openai.py 里,timeout 被直接写死为 300 秒,没有任何注释或配置入口可以修改 代码参考

为什么升级时没有把这个参数做成可配置?目前没有官方说明,但常见原因可能包括:早期设计时为了简单直接,或者担心长时间挂起请求会导致资源占用、系统响应变慢等问题。Dify 的插件架构是和主程序分开的,很多高级参数(比如 timeout)需要专门实现,不能自动继承主程序的配置逻辑 相关讨论

如果你真的需要修改这个超时,只能手动改代码并重建镜像(比如把 timeout 改成更长),或者等后续版本支持配置化。要实现配置化,开发者需要在插件配置结构里加 timeout 字段,并在请求时读取和应用,这部分目前还没有实现 相关说明

最后,超时设置太长也有风险,比如请求挂死会拖慢系统,所以官方可能会比较谨慎。如果你有特殊需求,可以在相关 issue 下反馈,推动官方考虑这个功能。

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

@dosubot[bot] commented on GitHub (Sep 12, 2025): <!-- Answer --> 目前 Dify 的 OpenAI-API-compatible 插件(比如你遇到的 300 秒超时问题)确实是把超时时间硬编码在插件代码里的,并没有通过配置文件或环境变量暴露出来让用户自定义。比如在 `common_openai.py` 里,timeout 被直接写死为 300 秒,没有任何注释或配置入口可以修改 [代码参考](https://github.com/langgenius/dify-official-plugins/blob/527c7b3b06c0d27262914d5b1313e0daac3c3513/models/openai_api_compatible/models/common_openai.py)。 为什么升级时没有把这个参数做成可配置?目前没有官方说明,但常见原因可能包括:早期设计时为了简单直接,或者担心长时间挂起请求会导致资源占用、系统响应变慢等问题。Dify 的插件架构是和主程序分开的,很多高级参数(比如 timeout)需要专门实现,不能自动继承主程序的配置逻辑 [相关讨论](https://github.com/langgenius/dify/issues/22100)。 如果你真的需要修改这个超时,只能手动改代码并重建镜像(比如把 timeout 改成更长),或者等后续版本支持配置化。要实现配置化,开发者需要在插件配置结构里加 timeout 字段,并在请求时读取和应用,这部分目前还没有实现 [相关说明](https://github.com/langgenius/dify/issues/22100)。 最后,超时设置太长也有风险,比如请求挂死会拖慢系统,所以官方可能会比较谨慎。如果你有特殊需求,可以在相关 issue 下反馈,推动官方考虑这个功能。 <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/226e4bb4-2def-4d86-b821-db94bc9742b4?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/226e4bb4-2def-4d86-b821-db94bc9742b4?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/226e4bb4-2def-4d86-b821-db94bc9742b4?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/226e4bb4-2def-4d86-b821-db94bc9742b4?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/226e4bb4-2def-4d86-b821-db94bc9742b4?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/226e4bb4-2def-4d86-b821-db94bc9742b4?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/226e4bb4-2def-4d86-b821-db94bc9742b4?feedback_type=other)</sup>&nbsp;&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify-official-plugins/issues/1705)
Author
Owner

@shihuimin1012 commented on GitHub (Sep 12, 2025):

好的,这个问题我会通过重新修改代码来解决;
另一个问题,对于 LM Studio 插件,我再添加模型时,已经选择了chat(页面上),但是调用llm就会导致报错缺少mode;但是OpenAI-API不会

@shihuimin1012 commented on GitHub (Sep 12, 2025): 好的,这个问题我会通过重新修改代码来解决; 另一个问题,对于 LM Studio 插件,我再添加模型时,已经选择了chat(页面上),但是调用llm就会导致报错缺少mode;但是OpenAI-API不会
Author
Owner

@dosubot[bot] commented on GitHub (Sep 12, 2025):

LM Studio 插件报 “缺少 mode” 是因为 Dify 的模型配置 DSL 文件里必须显式加上 mode 字段(比如 mode: chatmode: completion),否则后端校验会报错。即使你在页面上选了 chat,实际配置里如果没有这个字段,还是会报错。你可以手动在模型配置里加上:

model_properties:
  mode: chat

这样就能解决 "missing mode" 的报错

OpenAI-API-compatible 插件不会报这个错,是因为它的实现里对 mode 字段有默认处理或容错逻辑,不会强制校验 "mode" 字段缺失

如果你用 LM Studio,建议直接在配置文件里加上 mode 字段,或者用 OpenAI-API-compatible 插件规避这个问题。

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

@dosubot[bot] commented on GitHub (Sep 12, 2025): <!-- Answer --> LM Studio 插件报 “缺少 mode” 是因为 Dify 的模型配置 DSL 文件里必须显式加上 `mode` 字段(比如 `mode: chat` 或 `mode: completion`),否则后端校验会报错。即使你在页面上选了 chat,实际配置里如果没有这个字段,还是会报错。你可以手动在模型配置里加上: ```yaml model_properties: mode: chat ``` 这样就能解决 ["missing mode" 的报错](https://github.com/langgenius/dify/issues/16180)。 OpenAI-API-compatible 插件不会报这个错,是因为它的实现里对 `mode` 字段有默认处理或容错逻辑,不会强制校验 ["mode" 字段缺失](https://github.com/langgenius/dify-official-plugins/issues/803#issuecomment-3241318583)。 如果你用 LM Studio,建议直接在配置文件里加上 `mode` 字段,或者用 OpenAI-API-compatible 插件规避这个问题。 <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/12ef70af-1725-498a-94b1-dc3e638d3357?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/12ef70af-1725-498a-94b1-dc3e638d3357?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/12ef70af-1725-498a-94b1-dc3e638d3357?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/12ef70af-1725-498a-94b1-dc3e638d3357?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/12ef70af-1725-498a-94b1-dc3e638d3357?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/12ef70af-1725-498a-94b1-dc3e638d3357?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/12ef70af-1725-498a-94b1-dc3e638d3357?feedback_type=other)</sup>&nbsp;&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify-official-plugins/issues/1705)
Author
Owner

@shihuimin1012 commented on GitHub (Sep 12, 2025):

好的 明白了 谢谢

另我第一个超时问题和https://github.com/langgenius/dify-official-plugins/issues/936#issuecomment-3284081819 是一样吗,如果一样,为什么他说的解决方案是【比较麻烦,进插件的docker环境,有个llm.py文件,进去找到超时相关的设置,把300改成你想要的时间就行】 和你的文件不是一个呢

@shihuimin1012 commented on GitHub (Sep 12, 2025): 好的 明白了 谢谢 另我第一个超时问题和https://github.com/langgenius/dify-official-plugins/issues/936#issuecomment-3284081819 是一样吗,如果一样,为什么他说的解决方案是【比较麻烦,进插件的docker环境,有个llm.py文件,进去找到超时相关的设置,把300改成你想要的时间就行】 和你的文件不是一个呢
Author
Owner

@dosubot[bot] commented on GitHub (Sep 12, 2025):

你的超时问题和你提到的 issue #936 是同一个本质问题,都是 300 秒超时写死在插件代码里,导致本地模型响应慢就会报错。解决方法确实是进 Docker 容器,手动修改插件里的超时参数,比如把 300 改成更大的数,这点和评论里说的是一样的参考

至于为什么有的方案让你改 llm.py,有的让你改 common_openai.py,其实是因为 Dify 不同插件(比如 Ollama、OpenAI-API-compatible、vLLM 等)实现结构不一样,超时参数可能写在不同的文件里。例如 Ollama 插件是在 models/llm/llm.py 里写死的,而 OpenAI-API-compatible 插件是在 models/openai_api_compatible/models/common_openai.py 里写死的参考。所以你需要根据你用的具体插件和版本,找到对应的文件去改。

总之,超时参数目前都不是统一可配置的,得手动改代码,具体改哪个文件要看插件实现和版本。

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

@dosubot[bot] commented on GitHub (Sep 12, 2025): <!-- Answer --> 你的超时问题和你提到的 issue #936 是同一个本质问题,都是 300 秒超时写死在插件代码里,导致本地模型响应慢就会报错。解决方法确实是进 Docker 容器,手动修改插件里的超时参数,比如把 300 改成更大的数,这点和评论里说的是一样的[参考](https://github.com/langgenius/dify-official-plugins/issues/936#issuecomment-3284081819)。 至于为什么有的方案让你改 `llm.py`,有的让你改 `common_openai.py`,其实是因为 Dify 不同插件(比如 Ollama、OpenAI-API-compatible、vLLM 等)实现结构不一样,超时参数可能写在不同的文件里。例如 Ollama 插件是在 `models/llm/llm.py` 里写死的,而 OpenAI-API-compatible 插件是在 `models/openai_api_compatible/models/common_openai.py` 里写死的[参考](https://github.com/langgenius/dify-official-plugins/issues/1529)。所以你需要根据你用的具体插件和版本,找到对应的文件去改。 总之,超时参数目前都不是统一可配置的,得手动改代码,具体改哪个文件要看插件实现和版本。 <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/9e012592-380c-45fe-abc6-831810a81e85?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/9e012592-380c-45fe-abc6-831810a81e85?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/9e012592-380c-45fe-abc6-831810a81e85?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/9e012592-380c-45fe-abc6-831810a81e85?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/9e012592-380c-45fe-abc6-831810a81e85?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/9e012592-380c-45fe-abc6-831810a81e85?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/9e012592-380c-45fe-abc6-831810a81e85?feedback_type=other)</sup>&nbsp;&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify-official-plugins/issues/1705)
Author
Owner

@shihuimin1012 commented on GitHub (Sep 16, 2025):

我直接进容器内修改参数,重启服务;未起作用;

Image Image
@shihuimin1012 commented on GitHub (Sep 16, 2025): 我直接进容器内修改参数,重启服务;未起作用; <img width="735" height="119" alt="Image" src="https://github.com/user-attachments/assets/cf11a1d9-43cc-48b9-b424-cb0045ea86be" /> <img width="780" height="674" alt="Image" src="https://github.com/user-attachments/assets/5eabe7bd-29bb-48c3-94a6-30de858095f2" />
Author
Owner

@dosubot[bot] commented on GitHub (Sep 16, 2025):

你在容器内直接改参数、重启服务后未生效,是因为 Docker 容器的文件系统是临时的,重启或重建后会恢复成原镜像内容。要让超时参数修改真正生效,必须在宿主机上修改 models/openai_api_compatible/models/common_openai.py 里的 Timeout(315.0, read=300.0, write=10.0, connect=5.0),然后重新构建镜像并用新镜像启动容器,或者用 volume 挂载覆盖这个文件,否则每次重启都会丢失你的更改,导致超时还是 300 秒 参考

简单流程如下:

  1. 在宿主机上修改 common_openai.py,把 read=300.0 改成你需要的时间。
  2. 重新 build 镜像(比如 docker build -t dify-custom .),然后用新镜像启动容器。
  3. 或者用 -v 参数把你本地修改过的 common_openai.py 挂载到容器对应路径。

如果这样做还是 300 秒超时,建议检查是否有 nginx、traefik 等反向代理或 Docker 网络层也设置了 300 秒的超时限制 相关讨论

只改容器内的文件、然后重启,绝大多数情况下不会生效,因为 Docker 会还原为镜像内容。

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

@dosubot[bot] commented on GitHub (Sep 16, 2025): <!-- Answer --> 你在容器内直接改参数、重启服务后未生效,是因为 Docker 容器的文件系统是临时的,重启或重建后会恢复成原镜像内容。要让超时参数修改真正生效,必须在宿主机上修改 `models/openai_api_compatible/models/common_openai.py` 里的 `Timeout(315.0, read=300.0, write=10.0, connect=5.0)`,然后重新构建镜像并用新镜像启动容器,或者用 volume 挂载覆盖这个文件,否则每次重启都会丢失你的更改,导致超时还是 300 秒 [参考](https://github.com/langgenius/dify-official-plugins/blob/a0357b280e8647c1d5d20e695f62185721ba19e2/models/openai_api_compatible/models/common_openai.py)。 简单流程如下: 1. 在宿主机上修改 `common_openai.py`,把 `read=300.0` 改成你需要的时间。 2. 重新 build 镜像(比如 `docker build -t dify-custom .`),然后用新镜像启动容器。 3. 或者用 `-v` 参数把你本地修改过的 `common_openai.py` 挂载到容器对应路径。 如果这样做还是 300 秒超时,建议检查是否有 nginx、traefik 等反向代理或 Docker 网络层也设置了 300 秒的超时限制 [相关讨论](https://github.com/langgenius/dify-official-plugins/issues/936)。 只改容器内的文件、然后重启,绝大多数情况下不会生效,因为 Docker 会还原为镜像内容。 <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/364776a5-2d6f-4089-84ed-43a746055b63?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/364776a5-2d6f-4089-84ed-43a746055b63?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/364776a5-2d6f-4089-84ed-43a746055b63?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/364776a5-2d6f-4089-84ed-43a746055b63?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/364776a5-2d6f-4089-84ed-43a746055b63?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/364776a5-2d6f-4089-84ed-43a746055b63?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/364776a5-2d6f-4089-84ed-43a746055b63?feedback_type=other)</sup>&nbsp;&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify-official-plugins/issues/1705)
Author
Owner

@shihuimin1012 commented on GitHub (Sep 16, 2025):

你在容器内直接改参数、重启服务后未生效,是因为 Docker 容器的文件系统是临时的,重启或重建后会恢复成原镜像内容。要让超时参数修改真正生效,必须在宿主机上修改 models/openai_api_compatible/models/common_openai.py 里的 Timeout(315.0, read=300.0, write=10.0, connect=5.0),然后重新构建镜像并用新镜像启动容器,或者用 volume 挂载覆盖这个文件,否则每次重启都会丢失你的更改,导致超时还是 300 秒 参考

简单流程如下:

  1. 在宿主机上修改 common_openai.py,把 read=300.0 改成你需要的时间。
  2. 重新 build 镜像(比如 docker build -t dify-custom .),然后用新镜像启动容器。
  3. 或者用 -v 参数把你本地修改过的 common_openai.py 挂载到容器对应路径。

如果这样做还是 300 秒超时,建议检查是否有 nginx、traefik 等反向代理或 Docker 网络层也设置了 300 秒的超时限制 相关讨论

只改容器内的文件、然后重启,绝大多数情况下不会生效,因为 Docker 会还原为镜像内容。

To reply, just mention @dosu.

How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

可是我改过后,看容器内代码确实是我改后得1800s

@shihuimin1012 commented on GitHub (Sep 16, 2025): > 你在容器内直接改参数、重启服务后未生效,是因为 Docker 容器的文件系统是临时的,重启或重建后会恢复成原镜像内容。要让超时参数修改真正生效,必须在宿主机上修改 `models/openai_api_compatible/models/common_openai.py` 里的 `Timeout(315.0, read=300.0, write=10.0, connect=5.0)`,然后重新构建镜像并用新镜像启动容器,或者用 volume 挂载覆盖这个文件,否则每次重启都会丢失你的更改,导致超时还是 300 秒 [参考](https://github.com/langgenius/dify-official-plugins/blob/a0357b280e8647c1d5d20e695f62185721ba19e2/models/openai_api_compatible/models/common_openai.py)。 > > 简单流程如下: > > 1. 在宿主机上修改 `common_openai.py`,把 `read=300.0` 改成你需要的时间。 > 2. 重新 build 镜像(比如 `docker build -t dify-custom .`),然后用新镜像启动容器。 > 3. 或者用 `-v` 参数把你本地修改过的 `common_openai.py` 挂载到容器对应路径。 > > 如果这样做还是 300 秒超时,建议检查是否有 nginx、traefik 等反向代理或 Docker 网络层也设置了 300 秒的超时限制 [相关讨论](https://github.com/langgenius/dify-official-plugins/issues/936)。 > > 只改容器内的文件、然后重启,绝大多数情况下不会生效,因为 Docker 会还原为镜像内容。 > > _To reply, just mention [@dosu](https://go.dosu.dev/dosubot)._ > > How did I do? [Good](https://app.dosu.dev/response-feedback/364776a5-2d6f-4089-84ed-43a746055b63?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/364776a5-2d6f-4089-84ed-43a746055b63?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/364776a5-2d6f-4089-84ed-43a746055b63?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/364776a5-2d6f-4089-84ed-43a746055b63?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/364776a5-2d6f-4089-84ed-43a746055b63?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/364776a5-2d6f-4089-84ed-43a746055b63?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/364776a5-2d6f-4089-84ed-43a746055b63?feedback_type=other)  [![Join Discord](https://camo.githubusercontent.com/d562c2df5e4567ea41d37f1d91a4da0839d8341037045b103b2da268998de17f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6a6f696e2d3538363546323f6c6f676f3d646973636f7264266c6f676f436f6c6f723d7768697465266c6162656c3d)](https://go.dosu.dev/discord-bot) [![Share on X](https://camo.githubusercontent.com/4649f705e2396d6f328dbc8e800a0509c9c17b3b20253b36706c393df124b93d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f582d73686172652d626c61636b)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify-official-plugins/issues/1705) 可是我改过后,看容器内代码确实是我改后得1800s
Author
Owner

@dosubot[bot] commented on GitHub (Sep 16, 2025):

你在容器内看到代码已经改成 1800s,但运行时还是 300s 超时,原因通常是 Docker 的文件系统是临时的,重启后会恢复成镜像内容。只有两种方法能让修改真正生效:一是在宿主机上改好代码后重新 build 镜像并用新镜像启动容器,二是用 -v 参数把本地改好的文件挂载到容器对应路径。否则,容器重启后会丢失你的更改,实际运行的还是旧代码 参考

如果你已经确认容器内代码是 1800s,但还是 300s 超时,还有可能是 nginx、traefik 等反向代理或 Docker 网络层也设置了 300 秒的超时限制,这些会覆盖应用层的设置 参考

建议你:

  1. 确认容器是用新镜像启动的(或 volume 挂载已生效)。
  2. 检查所有相关服务和代理的超时设置,确保没有外部 300s 限制。
  3. 如果有多个容器或服务,全部都要更新和重启。

这样才能确保你的超时参数真正生效。

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

@dosubot[bot] commented on GitHub (Sep 16, 2025): <!-- Answer --> 你在容器内看到代码已经改成 1800s,但运行时还是 300s 超时,原因通常是 Docker 的文件系统是临时的,重启后会恢复成镜像内容。只有两种方法能让修改真正生效:一是在宿主机上改好代码后重新 build 镜像并用新镜像启动容器,二是用 `-v` 参数把本地改好的文件挂载到容器对应路径。否则,容器重启后会丢失你的更改,实际运行的还是旧代码 [参考](https://github.com/langgenius/dify-official-plugins/issues/936#issuecomment-3284070706)。 如果你已经确认容器内代码是 1800s,但还是 300s 超时,还有可能是 nginx、traefik 等反向代理或 Docker 网络层也设置了 300 秒的超时限制,这些会覆盖应用层的设置 [参考](https://github.com/langgenius/dify-official-plugins/issues/1019#issuecomment-3278831936)。 建议你: 1. 确认容器是用新镜像启动的(或 volume 挂载已生效)。 2. 检查所有相关服务和代理的超时设置,确保没有外部 300s 限制。 3. 如果有多个容器或服务,全部都要更新和重启。 这样才能确保你的超时参数真正生效。 <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/d9c6d7fb-8179-49f2-a337-4772bf4f7602?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/d9c6d7fb-8179-49f2-a337-4772bf4f7602?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/d9c6d7fb-8179-49f2-a337-4772bf4f7602?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/d9c6d7fb-8179-49f2-a337-4772bf4f7602?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/d9c6d7fb-8179-49f2-a337-4772bf4f7602?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/d9c6d7fb-8179-49f2-a337-4772bf4f7602?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/d9c6d7fb-8179-49f2-a337-4772bf4f7602?feedback_type=other)</sup>&nbsp;&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify-official-plugins/issues/1705)
Author
Owner

@shihuimin1012 commented on GitHub (Sep 16, 2025):

你在容器内看到代码已经改成 1800s,但运行时还是 300s 超时,原因通常是 Docker 的文件系统是临时的,重启后会恢复成镜像内容。只有两种方法能让修改真正生效:一是在宿主机上改好代码后重新 build 镜像并用新镜像启动容器,二是用 -v 参数把本地改好的文件挂载到容器对应路径。否则,容器重启后会丢失你的更改,实际运行的还是旧代码 参考

如果你已经确认容器内代码是 1800s,但还是 300s 超时,还有可能是 nginx、traefik 等反向代理或 Docker 网络层也设置了 300 秒的超时限制,这些会覆盖应用层的设置 参考

建议你:

  1. 确认容器是用新镜像启动的(或 volume 挂载已生效)。
  2. 检查所有相关服务和代理的超时设置,确保没有外部 300s 限制。
  3. 如果有多个容器或服务,全部都要更新和重启。

这样才能确保你的超时参数真正生效。

To reply, just mention @dosu.

How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

1.当前改的是挂载目录下的代码文件,确定容器是1800s

@shihuimin1012 commented on GitHub (Sep 16, 2025): > 你在容器内看到代码已经改成 1800s,但运行时还是 300s 超时,原因通常是 Docker 的文件系统是临时的,重启后会恢复成镜像内容。只有两种方法能让修改真正生效:一是在宿主机上改好代码后重新 build 镜像并用新镜像启动容器,二是用 `-v` 参数把本地改好的文件挂载到容器对应路径。否则,容器重启后会丢失你的更改,实际运行的还是旧代码 [参考](https://github.com/langgenius/dify-official-plugins/issues/936#issuecomment-3284070706)。 > > 如果你已经确认容器内代码是 1800s,但还是 300s 超时,还有可能是 nginx、traefik 等反向代理或 Docker 网络层也设置了 300 秒的超时限制,这些会覆盖应用层的设置 [参考](https://github.com/langgenius/dify-official-plugins/issues/1019#issuecomment-3278831936)。 > > 建议你: > > 1. 确认容器是用新镜像启动的(或 volume 挂载已生效)。 > 2. 检查所有相关服务和代理的超时设置,确保没有外部 300s 限制。 > 3. 如果有多个容器或服务,全部都要更新和重启。 > > 这样才能确保你的超时参数真正生效。 > > _To reply, just mention [@dosu](https://go.dosu.dev/dosubot)._ > > How did I do? [Good](https://app.dosu.dev/response-feedback/d9c6d7fb-8179-49f2-a337-4772bf4f7602?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/d9c6d7fb-8179-49f2-a337-4772bf4f7602?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/d9c6d7fb-8179-49f2-a337-4772bf4f7602?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/d9c6d7fb-8179-49f2-a337-4772bf4f7602?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/d9c6d7fb-8179-49f2-a337-4772bf4f7602?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/d9c6d7fb-8179-49f2-a337-4772bf4f7602?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/d9c6d7fb-8179-49f2-a337-4772bf4f7602?feedback_type=other)  [![Join Discord](https://camo.githubusercontent.com/d562c2df5e4567ea41d37f1d91a4da0839d8341037045b103b2da268998de17f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6a6f696e2d3538363546323f6c6f676f3d646973636f7264266c6f676f436f6c6f723d7768697465266c6162656c3d)](https://go.dosu.dev/discord-bot) [![Share on X](https://camo.githubusercontent.com/4649f705e2396d6f328dbc8e800a0509c9c17b3b20253b36706c393df124b93d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f582d73686172652d626c61636b)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify-official-plugins/issues/1705) 1.当前改的是挂载目录下的代码文件,确定容器是1800s
Author
Owner

@leomsn commented on GitHub (Sep 26, 2025):

LM Studio 插件报 “缺少 mode” 是因为 Dify 的模型配置 DSL 文件里必须显式加上 mode 字段(比如 mode: chatmode: completion),否则后端校验会报错。即使你在页面上选了 chat,实际配置里如果没有这个字段,还是会报错。你可以手动在模型配置里加上:

model_properties:
mode: chat
这样就能解决 "missing mode" 的报错

OpenAI-API-compatible 插件不会报这个错,是因为它的实现里对 mode 字段有默认处理或容错逻辑,不会强制校验 "mode" 字段缺失

如果你用 LM Studio,建议直接在配置文件里加上 mode 字段,或者用 OpenAI-API-compatible 插件规避这个问题。

To reply, just mention @dosu.

How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

看了很多个回复,没有一个确切的说法如何增加这个配置参数,具体到哪里能找到这个YAML文件可以进行手工修改?是AI支持人员自己想象出来的配置文件吗?@dosu

@leomsn commented on GitHub (Sep 26, 2025): > LM Studio 插件报 “缺少 mode” 是因为 Dify 的模型配置 DSL 文件里必须显式加上 `mode` 字段(比如 `mode: chat` 或 `mode: completion`),否则后端校验会报错。即使你在页面上选了 chat,实际配置里如果没有这个字段,还是会报错。你可以手动在模型配置里加上: > > model_properties: > mode: chat > 这样就能解决 ["missing mode" 的报错](https://github.com/langgenius/dify/issues/16180)。 > > OpenAI-API-compatible 插件不会报这个错,是因为它的实现里对 `mode` 字段有默认处理或容错逻辑,不会强制校验 ["mode" 字段缺失](https://github.com/langgenius/dify-official-plugins/issues/803#issuecomment-3241318583)。 > > 如果你用 LM Studio,建议直接在配置文件里加上 `mode` 字段,或者用 OpenAI-API-compatible 插件规避这个问题。 > > _To reply, just mention [@dosu](https://go.dosu.dev/dosubot)._ > > How did I do? [Good](https://app.dosu.dev/response-feedback/12ef70af-1725-498a-94b1-dc3e638d3357?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/12ef70af-1725-498a-94b1-dc3e638d3357?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/12ef70af-1725-498a-94b1-dc3e638d3357?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/12ef70af-1725-498a-94b1-dc3e638d3357?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/12ef70af-1725-498a-94b1-dc3e638d3357?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/12ef70af-1725-498a-94b1-dc3e638d3357?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/12ef70af-1725-498a-94b1-dc3e638d3357?feedback_type=other)  [![Join Discord](https://camo.githubusercontent.com/d562c2df5e4567ea41d37f1d91a4da0839d8341037045b103b2da268998de17f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6a6f696e2d3538363546323f6c6f676f3d646973636f7264266c6f676f436f6c6f723d7768697465266c6162656c3d)](https://go.dosu.dev/discord-bot) [![Share on X](https://camo.githubusercontent.com/4649f705e2396d6f328dbc8e800a0509c9c17b3b20253b36706c393df124b93d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f582d73686172652d626c61636b)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify-official-plugins/issues/1705) 看了很多个回复,没有一个确切的说法如何增加这个配置参数,具体到哪里能找到这个YAML文件可以进行手工修改?是AI支持人员自己想象出来的配置文件吗?@dosu
Author
Owner

@dosubot[bot] commented on GitHub (Oct 12, 2025):

Hi, @shihuimin1012. I'm Dosu, and I'm helping the dify-official-plugins team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You reported a persistent 300-second timeout error with the OpenAI-API-compatible plugin in Dify 1.2.0 when using a slow self-hosted local model.
  • The timeout is hardcoded in the plugin backend (common_openai.py) and not affected by environment variables.
  • Resolving this requires manual code edits on the host, rebuilding or mounting the Docker image properly to persist changes.
  • Additional checks include verifying reverse proxy or Docker network timeout settings that might override the timeout.
  • For LM Studio plugins, a correct 'mode' field in the model config is necessary to avoid "missing mode" errors.

Next Steps:

  • Please confirm if this issue is still relevant with the latest version of dify-official-plugins; if so, you can keep the discussion open by commenting here.
  • Otherwise, I will automatically close this issue in 5 days.

Thank you for your understanding and contribution!

@dosubot[bot] commented on GitHub (Oct 12, 2025): Hi, @shihuimin1012. I'm [Dosu](https://dosu.dev), and I'm helping the dify-official-plugins team manage their backlog and am marking this issue as stale. **Issue Summary:** - You reported a persistent 300-second timeout error with the OpenAI-API-compatible plugin in Dify 1.2.0 when using a slow self-hosted local model. - The timeout is hardcoded in the plugin backend (common_openai.py) and not affected by environment variables. - Resolving this requires manual code edits on the host, rebuilding or mounting the Docker image properly to persist changes. - Additional checks include verifying reverse proxy or Docker network timeout settings that might override the timeout. - For LM Studio plugins, a correct 'mode' field in the model config is necessary to avoid "missing mode" errors. **Next Steps:** - Please confirm if this issue is still relevant with the latest version of dify-official-plugins; if so, you can keep the discussion open by commenting here. - Otherwise, I will automatically close this issue in 5 days. Thank you for your understanding and contribution!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-official-plugins#643