connection error
Self Checks
- [x] This is only for bug report, if you would like to ask a question, please head to Discussions.
- [x] I have searched for existing issues search for existing issues, including closed ones.
- [x] I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
- [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
- [x] Please do not modify this template :) and fill in all the required fields.
Dify version
1.0.0
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
If the link fails, it should return a 502 or 503 status code, instead of causing the program to crash and returning a 500 status code:
2025-03-08 18:47:28 INFO [alembic.runtime.migration] Context impl PostgresqlImpl.
2025-03-08 18:47:28 INFO [alembic.runtime.migration] Will assume transactional DDL.
2025-03-08 18:47:28 [2025-03-08 10:47:28 +0000] [1] [INFO] Starting gunicorn 23.0.0
2025-03-08 18:47:28 [2025-03-08 10:47:28 +0000] [1] [INFO] Listening at: http://0.0.0.0:5001 (1)
2025-03-08 18:47:28 [2025-03-08 10:47:28 +0000] [1] [INFO] Using worker: gevent
2025-03-08 18:47:28 [2025-03-08 10:47:28 +0000] [28] [INFO] Booting worker with pid: 28
2025-03-08 19:35:04 INFO [alembic.runtime.migration] Context impl PostgresqlImpl.
2025-03-08 19:35:04 INFO [alembic.runtime.migration] Will assume transactional DDL.
2025-03-08 19:35:05 [2025-03-08 11:35:05 +0000] [1] [INFO] Starting gunicorn 23.0.0
2025-03-08 19:35:05 [2025-03-08 11:35:05 +0000] [1] [INFO] Listening at: http://0.0.0.0:5001 (1)
2025-03-08 19:35:05 [2025-03-08 11:35:05 +0000] [1] [INFO] Using worker: gevent
2025-03-08 19:35:05 [2025-03-08 11:35:05 +0000] [27] [INFO] Booting worker with pid: 27
2025-03-08 19:36:39 [2025-03-08 11:36:39 +0000] [1] [INFO] Handling signal: term
2025-03-08 19:36:40 [2025-03-08 11:36:40 +0000] [27] [INFO] Worker exiting (pid: 27)
2025-03-08 19:36:40 [2025-03-08 11:36:40 +0000] [1] [INFO] Shutting down: Master
2025-03-08 19:37:09 INFO [alembic.runtime.migration] Context impl PostgresqlImpl.
2025-03-08 19:37:09 INFO [alembic.runtime.migration] Will assume transactional DDL.
2025-03-08 19:37:10 [2025-03-08 11:37:10 +0000] [1] [INFO] Starting gunicorn 23.0.0
2025-03-08 19:37:10 [2025-03-08 11:37:10 +0000] [1] [INFO] Listening at: http://0.0.0.0:5001 (1)
2025-03-08 19:37:10 [2025-03-08 11:37:10 +0000] [1] [INFO] Using worker: gevent
2025-03-08 19:37:10 [2025-03-08 11:37:10 +0000] [28] [INFO] Booting worker with pid: 28
2025-03-08 20:11:10 ^^^^^^
2025-03-08 20:11:10 File "/app/api/core/plugin/manager/model.py", line 189, in invoke_llm
2025-03-08 20:11:10 yield from response
2025-03-08 20:11:10 File "/app/api/core/plugin/manager/base.py", line 189, in _request_with_plugin_daemon_response_stream
2025-03-08 20:11:10 self._handle_plugin_daemon_error(error.error_type, error.message)
2025-03-08 20:11:10 File "/app/api/core/plugin/manager/base.py", line 215, in _handle_plugin_daemon_error
2025-03-08 20:11:10 raise InvokeConnectionError(description=args.get("description"))
2025-03-08 20:11:10 core.model_runtime.errors.invoke.InvokeConnectionError: [models] Connection Error, Connection error.
✔️ Expected Behavior
No response
❌ Actual Behavior
No response
I found a similar unsolved discussion regarding connection errors when setting up a model provider in the Dify repository. You can view it here [1].
Regarding your issue, the InvokeConnectionError in the Dify codebase typically occurs due to connection errors during invocation. This can be caused by server unavailability, rate limits, authorization failures, or parameter errors [2]. The _handle_plugin_daemon_error function in the code is responsible for handling such errors by raising the appropriate exceptions based on the error type and message [3].
To address the issue of receiving a 400 status code instead of a 502 or 503, you might want to check the request formatting and ensure that the connection settings are correctly configured, especially in a self-hosted Docker environment. The Dify application uses environment variables and Docker configurations to manage these settings [4][5].
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