Bug in openai_api_compatible: Failed to generate output via the model. #20618

Closed
opened 2026-02-21 20:08:11 -05:00 by yindo · 5 comments
Owner

Originally created by @wbext on GitHub (Nov 27, 2025).

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • 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, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.9.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

I'm using an OpenAI-compatible model for image generation, but the plugin sometimes throws an error:[openai_api_compatible] Error: req_id: 38b3a2e985 PluginInvokeError: {"args":{},"error_type":"ChunkedEncodingError","message":"Response ended prematurely"}
I have no idea what's causing this bug. Could anyone knowledgeable help me figure it out?

Image

✔️ Expected Behavior

This workflow usually works normally, but occasionally throws such a bug

Actual Behavior

No response

Originally created by @wbext on GitHub (Nov 27, 2025). ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [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, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.9.1 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce I'm using an OpenAI-compatible model for image generation, but the plugin sometimes throws an error:[openai_api_compatible] Error: req_id: 38b3a2e985 PluginInvokeError: {"args":{},"error_type":"ChunkedEncodingError","message":"Response ended prematurely"} I have no idea what's causing this bug. Could anyone knowledgeable help me figure it out? <img width="457" height="875" alt="Image" src="https://github.com/user-attachments/assets/0d6c2c25-93ba-4617-92f2-a26d5d5dec33" /> ### ✔️ Expected Behavior This workflow usually works normally, but occasionally throws such a bug ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug label 2026-02-21 20:08:11 -05:00
yindo closed this issue 2026-02-21 20:08:11 -05:00
Author
Owner

@wbext commented on GitHub (Nov 27, 2025):

The version of the OpenAI-API-compatible plugin is 0.0.24.

@wbext commented on GitHub (Nov 27, 2025): The version of the OpenAI-API-compatible plugin is 0.0.24.
Author
Owner

@dosubot[bot] commented on GitHub (Nov 27, 2025):

Thanks for sharing the plugin version. The 'ChunkedEncodingError' ("Response ended prematurely") is a known intermittent issue with the OpenAI-API-compatible plugin, especially in Docker setups and with image/vision models. It's usually caused by interruptions in the HTTP streaming response—network hiccups, server timeouts, or proxy buffering can close the stream before the plugin finishes sending data, which aborts the workflow and leaves empty output. There are also some regressions and input parsing bugs reported in recent plugin versions, including 0.0.24 source.

To reduce these errors: increase timeouts in your Docker .env, disable proxy buffering in NGINX, and raise Uvicorn's timeout-keep-alive if you run it directly. If you want to avoid streaming issues, you can try forcing non-streaming mode by setting "stream": false in the plugin code (this isn't exposed in the UI) source. Also, double-check your request JSON structure—missing or malformed fields (like the User message) can trigger similar errors source.

If the error persists, consider testing with an alternative plugin like Regolo.ai, which has better streaming support for vision models source. Let me know if you want step-by-step instructions for any of these changes.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Nov 27, 2025): <!-- Answer --> Thanks for sharing the plugin version. The 'ChunkedEncodingError' ("Response ended prematurely") is a known intermittent issue with the OpenAI-API-compatible plugin, especially in Docker setups and with image/vision models. It's usually caused by interruptions in the HTTP streaming response—network hiccups, server timeouts, or proxy buffering can close the stream before the plugin finishes sending data, which aborts the workflow and leaves empty output. There are also some regressions and input parsing bugs reported in recent plugin versions, including 0.0.24 [source](https://github.com/langgenius/dify-official-plugins/issues/2043). To reduce these errors: increase timeouts in your Docker `.env`, disable proxy buffering in NGINX, and raise Uvicorn's `timeout-keep-alive` if you run it directly. If you want to avoid streaming issues, you can try forcing non-streaming mode by setting `"stream": false` in the plugin code (this isn't exposed in the UI) [source](https://github.com/langgenius/dify-official-plugins/issues/1781). Also, double-check your request JSON structure—missing or malformed fields (like the User message) can trigger similar errors [source](https://github.com/langgenius/dify-official-plugins/issues/1781). If the error persists, consider testing with an alternative plugin like Regolo.ai, which has better streaming support for vision models [source](https://github.com/langgenius/dify-official-plugins/issues/1781). Let me know if you want step-by-step instructions for any of these changes. <!-- 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/fd1bafff-4c51-448c-a843-72b874e0c9da?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/fd1bafff-4c51-448c-a843-72b874e0c9da?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/fd1bafff-4c51-448c-a843-72b874e0c9da?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/fd1bafff-4c51-448c-a843-72b874e0c9da?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/fd1bafff-4c51-448c-a843-72b874e0c9da?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/fd1bafff-4c51-448c-a843-72b874e0c9da?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/fd1bafff-4c51-448c-a843-72b874e0c9da?feedback_type=other)</sup> [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=Thanks%20for%20sharing%20the%20plugin%20version.%20The%20%27ChunkedEncodingError%27%20%28%22Response%20ended%20prematurely%22%29%20is%20a%20known%20intermittent%20issue%20with%20the%20OpenAI-API-compatible%20plugin%2C%20especially%20in%20Docker%20setups%20and%20with%20image/vision%20models.%20It%27s%20usually%20caused%20by%20interruptions%20in%20the%20HTTP%20streaming%20response%E2%80%94network%20hiccups%2C%20server%20timeouts%2C%20or%20proxy%20buffering%20can%20close%20the%20stream%20before%20the%20plugin%20finishes%20sending%20data%2C%20which%20aborts%20the%20workflow%20and%20leaves%20empty%20output.%20There%20are%20also%20some%20regressions%20and%20input%20parsing%20bugs%20reported%20in%20recent%20plugin%20versions%2C%20including%200.0.24%20%5Bsource%5D%28https%3A//github.com/langgenius/dify-official-plugins/issues/2043%29.%0A%0ATo%20reduce%20these%20errors%3A%20increase%20timeouts%20in%20your%20Docker%20%60.env%60%2C%20disable%20proxy%20buffering%20in%20NGINX%2C%20and%20raise%20Uvicorn%27s%20%60timeout-keep-alive%60%20if%20you%20run%20it%20directly.%20If%20you%20want%20to%20avoid%20streaming%20issues%2C%20you%20can%20try%20forcing%20non-streaming%20mode%20by%20setting%20%60%22stream%22%3A%20false%60%20in%20the%20plugin%20code%20%28this%20isn%27t%20exposed%20in%20the%20UI%29%20%5Bsource%5D%28https%3A//github.com/langgenius/dify-official-plugins/issues/1781%29.%20Also%2C%20double-check%20your%20request%20JSON%20structure%E2%80%94missing%20or%20malformed%20fields%20%28like%20the%20User%20message%29%20can%20trigger%20similar%20errors%20%5Bsource%5D%28https%3A//github.com/langgenius/dify-official-plugins/issues/1781%29.%0A%0AIf%20the%20error%20persists%2C%20consider%20testing%20with%20an%20alternative%20plugin%20like%20Regolo.ai%2C%20which%20has%20better%20streaming%20support%20for%20vision%20models%20%5Bsource%5D%28https%3A//github.com/langgenius/dify-official-plugins/issues/1781%29.%20Let%20me%20know%20if%20you%20want%20step-by-step%20instructions%20for%20any%20of%20these%20changes.)&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/28795)
Author
Owner

@wbext commented on GitHub (Nov 27, 2025):

I'm running a private Docker deployment. Can increasing Docker's timeout resolve this issue? If so, where exactly should I modify the settings?

@wbext commented on GitHub (Nov 27, 2025): I'm running a private Docker deployment. Can increasing Docker's timeout resolve this issue? If so, where exactly should I modify the settings?
Author
Owner

@dosubot[bot] commented on GitHub (Nov 27, 2025):

Yes, increasing timeout settings can help resolve the "ChunkedEncodingError" in your Docker deployment, since this error is usually caused by the HTTP connection closing before the plugin finishes streaming its response. The most relevant settings are not in Docker itself, but in the environment variables used by Dify's services and NGINX proxy.

To increase timeouts, edit your .env file (or docker-compose.yaml under the relevant service) and set these variables:

  • GUNICORN_TIMEOUT=360 (or higher, in seconds)
  • NGINX_PROXY_READ_TIMEOUT=3600s
  • NGINX_PROXY_SEND_TIMEOUT=3600s
  • PLUGIN_MAX_EXECUTION_TIMEOUT=2400 (for long-running plugin tasks)

You can find all these variables documented in docker/.env.example. After editing your .env file, restart your Docker stack with:

docker compose down
docker compose up -d

If you use a reverse proxy in front of Docker (like a cloud load balancer or Traefik), make sure its timeouts are also set high enough to avoid similar errors. For more details, see the relevant config files and discussions:
NGINX proxy and Gunicorn timeouts
Plugin daemon and execution timeouts
Example .env settings

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Nov 27, 2025): <!-- Answer --> Yes, increasing timeout settings can help resolve the "ChunkedEncodingError" in your Docker deployment, since this error is usually caused by the HTTP connection closing before the plugin finishes streaming its response. The most relevant settings are not in Docker itself, but in the environment variables used by Dify's services and NGINX proxy. To increase timeouts, edit your `.env` file (or `docker-compose.yaml` under the relevant service) and set these variables: - `GUNICORN_TIMEOUT=360` (or higher, in seconds) - `NGINX_PROXY_READ_TIMEOUT=3600s` - `NGINX_PROXY_SEND_TIMEOUT=3600s` - `PLUGIN_MAX_EXECUTION_TIMEOUT=2400` (for long-running plugin tasks) You can find all these variables documented in `docker/.env.example`. After editing your `.env` file, restart your Docker stack with: ```bash docker compose down docker compose up -d ``` If you use a reverse proxy in front of Docker (like a cloud load balancer or Traefik), make sure its timeouts are also set high enough to avoid similar errors. For more details, see the relevant config files and discussions: [NGINX proxy and Gunicorn timeouts](https://github.com/langgenius/dify/issues/24249) [Plugin daemon and execution timeouts](https://github.com/langgenius/dify/issues/15082) [Example .env settings](https://github.com/langgenius/dify/blob/dc9b3a7e034c348f437f5350543be8319591d29a/docker/.env.example) <!-- 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/376acbfb-a7a6-4e8e-8238-4e6401580952?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/376acbfb-a7a6-4e8e-8238-4e6401580952?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/376acbfb-a7a6-4e8e-8238-4e6401580952?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/376acbfb-a7a6-4e8e-8238-4e6401580952?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/376acbfb-a7a6-4e8e-8238-4e6401580952?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/376acbfb-a7a6-4e8e-8238-4e6401580952?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/376acbfb-a7a6-4e8e-8238-4e6401580952?feedback_type=other)</sup> [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=Yes%2C%20increasing%20timeout%20settings%20can%20help%20resolve%20the%20%22ChunkedEncodingError%22%20in%20your%20Docker%20deployment%2C%20since%20this%20error%20is%20usually%20caused%20by%20the%20HTTP%20connection%20closing%20before%20the%20plugin%20finishes%20streaming%20its%20response.%20The%20most%20relevant%20settings%20are%20not%20in%20Docker%20itself%2C%20but%20in%20the%20environment%20variables%20used%20by%20Dify%27s%20services%20and%20NGINX%20proxy.%0A%0ATo%20increase%20timeouts%2C%20edit%20your%20%60.env%60%20file%20%28or%20%60docker-compose.yaml%60%20under%20the%20relevant%20service%29%20and%20set%20these%20variables%3A%0A%0A-%20%60GUNICORN_TIMEOUT%3D360%60%20%28or%20higher%2C%20in%20seconds%29%0A-%20%60NGINX_PROXY_READ_TIMEOUT%3D3600s%60%0A-%20%60NGINX_PROXY_SEND_TIMEOUT%3D3600s%60%0A-%20%60PLUGIN_MAX_EXECUTION_TIMEOUT%3D2400%60%20%28for%20long-running%20plugin%20tasks%29%0A%0AYou%20can%20find%20all%20these%20variables%20documented%20in%20%60docker/.env.example%60.%20After%20editing%20your%20%60.env%60%20file%2C%20restart%20your%20Docker%20stack%20with%3A%0A%0A%60%60%60bash%0Adocker%20compose%20down%0Adocker%20compose%20up%20-d%0A%60%60%60%0A%0AIf%20you%20use%20a%20reverse%20proxy%20in%20front%20of%20Docker%20%28like%20a%20cloud%20load%20balancer%20or%20Traefik%29%2C%20make%20sure%20its%20timeouts%20are%20also%20set%20high%20enough%20to%20avoid%20similar%20errors.%20For%20more%20details%2C%20see%20the%20relevant%20config%20files%20and%20discussions%3A%20%20%0A%5BNGINX%20proxy%20and%20Gunicorn%20timeouts%5D%28https%3A//github.com/langgenius/dify/issues/24249%29%20%20%0A%5BPlugin%20daemon%20and%20execution%20timeouts%5D%28https%3A//github.com/langgenius/dify/issues/15082%29%20%20%0A%5BExample%20.env%20settings%5D%28https%3A//github.com/langgenius/dify/blob/dc9b3a7e034c348f437f5350543be8319591d29a/docker/.env.example%29)&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/28795)
Author
Owner

@wbext commented on GitHub (Nov 27, 2025):

Why do these variables need to be set to faster values (or even in a matter of seconds)? Also, do both the .env and docker-compose.yml files need to be modified?

@wbext commented on GitHub (Nov 27, 2025): Why do these variables need to be set to faster values (or even in a matter of seconds)? Also, do both the .env and docker-compose.yml files need to be modified?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#20618