[openai_api_compatible] Error: PluginInvokeError: {"args":{},"error_type":"ChunkedEncodingError","message":"Response ended prematurely"} #338

Closed
opened 2026-02-16 10:19:02 -05:00 by yindo · 4 comments
Owner

Originally created by @wangyeupc2012 on GitHub (Jun 4, 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.1.3 & 1.4.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

I'm writing to report an issue I encountered while integrating the Qwen3-32B model with Dify. Here's the background and details:
Background:
When integrating the Qwen3-32B model, since the model startup parameters did not include the configuration "enable_thinking=False" and I didn't want the thinking process to be output, I performed secondary encapsulation on this Qwen3-32B model and manually added this parameter. Here's the code snippet:

data = {
    "model": model,
    "stream": stream,
    "max_tokens": max_tokens,
    "temperature": temperature,
    "top_p": top_p,
    "top_k": top_k,
    "messages": messages,
    "chat_template_kwargs": {
        "enable_thinking": False
    }
}

Issue:
After the encapsulation, Dify can connect to the model normally. However, an error occurs during non-streaming requests (response_mode=blocking).
Could you please help me investigate this problem? Any assistance would be greatly appreciated.
Thank you!

Image

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @wangyeupc2012 on GitHub (Jun 4, 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.1.3 & 1.4.1 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce I'm writing to report an issue I encountered while integrating the Qwen3-32B model with Dify. Here's the background and details: Background: When integrating the Qwen3-32B model, since the model startup parameters did not include the configuration "enable_thinking=False" and I didn't want the thinking process to be output, I performed secondary encapsulation on this Qwen3-32B model and manually added this parameter. Here's the code snippet: ```python data = { "model": model, "stream": stream, "max_tokens": max_tokens, "temperature": temperature, "top_p": top_p, "top_k": top_k, "messages": messages, "chat_template_kwargs": { "enable_thinking": False } } ``` Issue: After the encapsulation, Dify can connect to the model normally. However, an error occurs during non-streaming requests (response_mode=blocking). Could you please help me investigate this problem? Any assistance would be greatly appreciated. Thank you! <img width="483" alt="Image" src="https://github.com/user-attachments/assets/40bf445b-b43f-497b-9f04-5072d1f2345c" /> ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo closed this issue 2026-02-16 10:19:02 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jun 4, 2025):

Hi @wangyeupc2012! I'm Dosu and I’m helping the dify team.

The error PluginInvokeError: {"args":{},"error_type":"ChunkedEncodingError","message":"Response ended prematurely"} during non-streaming requests with the Qwen3-32B model in Dify is likely caused by an issue in the HTTP response between Dify and your model backend. This type of error typically occurs when the backend model server closes the connection or fails to send a complete response, which can happen due to timeouts, network interruptions, or the backend not handling non-streaming (blocking) requests as expected.

Your approach of setting "enable_thinking": False is correct for non-streaming calls with Qwen3 models, as confirmed by relevant discussions in the Dify community. However, the Dify core codebase does not reference or process the enable_thinking parameter directly; it simply passes it through to the model backend. Any issues related to this parameter or the response handling would originate from your custom plugin code or the upstream model server, not from Dify itself [source].

To troubleshoot:

  • Ensure your Qwen3-32B backend or plugin correctly supports non-streaming (blocking) requests and does not prematurely close the connection.
  • Check for any timeouts or errors in the backend logs that might cause the response to end before Dify receives the full result.
  • Confirm that the backend correctly processes the enable_thinking parameter and that it does not introduce unexpected behavior for non-streaming requests.
  • If you are using a plugin or wrapper, verify that it handles both streaming and non-streaming modes according to the OpenAI-compatible API expectations.

If the backend or plugin does not fully support non-streaming requests, you may need to adjust its implementation or configuration. The Dify infrastructure itself is agnostic to the enable_thinking parameter and relies on the backend to handle it appropriately [source].

If you need more targeted help, please provide details about your backend logs or plugin implementation for non-streaming requests.

To reply, just mention my name @dosu.


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

@dosubot[bot] commented on GitHub (Jun 4, 2025): <!-- Greeting --> Hi @wangyeupc2012! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the dify team. <!-- Answer --> The error `PluginInvokeError: {"args":{},"error_type":"ChunkedEncodingError","message":"Response ended prematurely"}` during non-streaming requests with the Qwen3-32B model in Dify is likely caused by an issue in the HTTP response between Dify and your model backend. This type of error typically occurs when the backend model server closes the connection or fails to send a complete response, which can happen due to timeouts, network interruptions, or the backend not handling non-streaming (blocking) requests as expected. Your approach of setting `"enable_thinking": False` is correct for non-streaming calls with Qwen3 models, as confirmed by relevant discussions in the Dify community. However, the Dify core codebase does not reference or process the `enable_thinking` parameter directly; it simply passes it through to the model backend. Any issues related to this parameter or the response handling would originate from your custom plugin code or the upstream model server, not from Dify itself [[source]](https://github.com/langgenius/dify/blob/006496f24ec1ff06ea9928fa8902905e070a5323/api/core/model_runtime/model_providers/__base/large_language_model.py). To troubleshoot: - Ensure your Qwen3-32B backend or plugin correctly supports non-streaming (blocking) requests and does not prematurely close the connection. - Check for any timeouts or errors in the backend logs that might cause the response to end before Dify receives the full result. - Confirm that the backend correctly processes the `enable_thinking` parameter and that it does not introduce unexpected behavior for non-streaming requests. - If you are using a plugin or wrapper, verify that it handles both streaming and non-streaming modes according to the OpenAI-compatible API expectations. If the backend or plugin does not fully support non-streaming requests, you may need to adjust its implementation or configuration. The Dify infrastructure itself is agnostic to the `enable_thinking` parameter and relies on the backend to handle it appropriately [[source]](https://github.com/langgenius/dify/blob/006496f24ec1ff06ea9928fa8902905e070a5323/api/core/plugin/impl/model.py). If you need more targeted help, please provide details about your backend logs or plugin implementation for non-streaming requests. <!-- Dosu Comment Footer --> *To reply, just mention my name [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/0954129e-50b9-4506-bcb1-4e83f9c523df?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/0954129e-50b9-4506-bcb1-4e83f9c523df?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/0954129e-50b9-4506-bcb1-4e83f9c523df?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/0954129e-50b9-4506-bcb1-4e83f9c523df?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/0954129e-50b9-4506-bcb1-4e83f9c523df?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/0954129e-50b9-4506-bcb1-4e83f9c523df?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/0954129e-50b9-4506-bcb1-4e83f9c523df?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/issues/20631)
Author
Owner

@JIeJaitt commented on GitHub (Jul 23, 2025):

same problem

@JIeJaitt commented on GitHub (Jul 23, 2025): same problem
Author
Owner

@dosubot[bot] commented on GitHub (Aug 20, 2025):

Hi, @wangyeupc2012. 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 "PluginInvokeError: ChunkedEncodingError: Response ended prematurely" when using the Qwen3-32B model with Dify in a self-hosted Docker setup.
  • The error appeared after adding "enable_thinking=False" for non-streaming requests.
  • The issue likely stems from the model backend prematurely closing the HTTP response, possibly due to timeouts or improper handling of non-streaming calls.
  • Dify itself does not process the "enable_thinking" parameter; the problem may lie in backend support or plugin implementation.
  • Another user has confirmed experiencing the same issue.

Next Steps:

  • Please confirm if this issue is still relevant with the latest version of the dify-official-plugins repository by commenting here.
  • If no further updates are provided, I will automatically close this issue in 5 days.

Thank you for your understanding and contribution!

@dosubot[bot] commented on GitHub (Aug 20, 2025): Hi, @wangyeupc2012. 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 "PluginInvokeError: ChunkedEncodingError: Response ended prematurely" when using the Qwen3-32B model with Dify in a self-hosted Docker setup. - The error appeared after adding "enable_thinking=False" for non-streaming requests. - The issue likely stems from the model backend prematurely closing the HTTP response, possibly due to timeouts or improper handling of non-streaming calls. - Dify itself does not process the "enable_thinking" parameter; the problem may lie in backend support or plugin implementation. - Another user has confirmed experiencing the same issue. **Next Steps:** - Please confirm if this issue is still relevant with the latest version of the dify-official-plugins repository by commenting here. - If no further updates are provided, I will automatically close this issue in 5 days. Thank you for your understanding and contribution!
Author
Owner

@paulthe13 commented on GitHub (Jan 10, 2026):

dify is a traaaash!
工作流甚至不能设置全局变量;循环节点内部不能嵌套循环节点;http节点的文件大小限制不能在面板上修改,居然需要用户去找配置文件,在配置文件中修改变量;调试功能几乎为0,一个迭代节点不能单步运行,居然需要从头开始,否则就是没有root;llm的参数在面板上拖动设置无效,点一下就恢复原状,最后也是需要进到配置文件中进行修改。
那我请问,号称低代码平台的dify,不应该门槛更低吗?自由度低和门槛高居然同时存在于一个平台,这不是垃圾谁是?
dify一生黑,顺便说一句,上一个如此垃圾的是tensorflow,炸环境更是一绝!

@paulthe13 commented on GitHub (Jan 10, 2026): dify is a traaaash! 工作流甚至不能设置全局变量;循环节点内部不能嵌套循环节点;http节点的文件大小限制不能在面板上修改,居然需要用户去找配置文件,在配置文件中修改变量;调试功能几乎为0,一个迭代节点不能单步运行,居然需要从头开始,否则就是没有root;llm的参数在面板上拖动设置无效,点一下就恢复原状,最后也是需要进到配置文件中进行修改。 那我请问,号称低代码平台的dify,不应该门槛更低吗?自由度低和门槛高居然同时存在于一个平台,这不是垃圾谁是? dify一生黑,顺便说一句,上一个如此垃圾的是tensorflow,炸环境更是一绝!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-official-plugins#338