Timeout Error When Adding Ollama Model in Dify 1.1.0 (PluginDaemonInternalServerError: killed by timeout) #116

Closed
opened 2026-02-16 11:19:47 -05:00 by yindo · 1 comment
Owner

Originally created by @zanghaibin on GitHub (Mar 20, 2025).

When attempting to integrate an Ollama model with Dify v1.1.0, the system throws a timeout error during credential validation. The error occurs specifically when calling the /console/api/workspaces/current/model-providers/langgenius/ollama/ollama/models endpoint.

Environment

Dify Version: 1.1.0
Deployment: Docker
Model Provider: Ollama
OS: centos7.9

Error Log
2025-03-20 12:57:21.622 ERROR [Dummy-8] [app.py:875] - Exception on /console/api/workspaces/current/model-providers/langgenius/ollama/ollama/models [POST] Traceback (most recent call last): File "/app/api/.venv/lib/python3.12/site-packages/flask/app.py", line 917, in full_dispatch_request rv = self.dispatch_request() ^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask/app.py", line 902, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask_restful/__init__.py", line 489, in wrapper resp = resource(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask/views.py", line 110, in view return current_app.ensure_sync(self.dispatch_request)(**kwargs) # type: ignore[no-any-return] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask_restful/__init__.py", line 604, in dispatch_request resp = meth(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/app/api/controllers/console/wraps.py", line 187, in decorated return view(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/app/api/libs/login.py", line 94, in decorated_view return current_app.ensure_sync(func)(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/controllers/console/wraps.py", line 30, in decorated return view(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/app/api/controllers/console/workspace/models.py", line 154, in post model_provider_service.save_model_credentials( File "/app/api/services/model_provider_service.py", line 237, in save_model_credentials provider_configuration.add_or_update_custom_model_credentials( File "/app/api/core/entities/provider_configuration.py", line 422, in add_or_update_custom_model_credentials provider_model_record, credentials = self.custom_model_credentials_validate(model_type, model, credentials) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/entities/provider_configuration.py", line 402, in custom_model_credentials_validate credentials = model_provider_factory.model_credentials_validate( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/model_runtime/model_providers/model_provider_factory.py", line 191, in model_credentials_validate self.plugin_model_manager.validate_model_credentials( File "/app/api/core/plugin/manager/model.py", line 137, in validate_model_credentials 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 223, in _handle_plugin_daemon_error raise PluginDaemonInternalServerError(description=message) core.plugin.manager.exc.PluginDaemonInternalServerError: PluginDaemonInternalServerError: killed by timeout

Originally created by @zanghaibin on GitHub (Mar 20, 2025). When attempting to integrate an Ollama model with Dify v1.1.0, the system throws a timeout error during credential validation. The error occurs specifically when calling the /console/api/workspaces/current/model-providers/langgenius/ollama/ollama/models endpoint. Environment Dify Version: 1.1.0 Deployment: Docker Model Provider: Ollama OS: centos7.9 Error Log `2025-03-20 12:57:21.622 ERROR [Dummy-8] [app.py:875] - Exception on /console/api/workspaces/current/model-providers/langgenius/ollama/ollama/models [POST] Traceback (most recent call last): File "/app/api/.venv/lib/python3.12/site-packages/flask/app.py", line 917, in full_dispatch_request rv = self.dispatch_request() ^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask/app.py", line 902, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask_restful/__init__.py", line 489, in wrapper resp = resource(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask/views.py", line 110, in view return current_app.ensure_sync(self.dispatch_request)(**kwargs) # type: ignore[no-any-return] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask_restful/__init__.py", line 604, in dispatch_request resp = meth(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/app/api/controllers/console/wraps.py", line 187, in decorated return view(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/app/api/libs/login.py", line 94, in decorated_view return current_app.ensure_sync(func)(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/controllers/console/wraps.py", line 30, in decorated return view(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/app/api/controllers/console/workspace/models.py", line 154, in post model_provider_service.save_model_credentials( File "/app/api/services/model_provider_service.py", line 237, in save_model_credentials provider_configuration.add_or_update_custom_model_credentials( File "/app/api/core/entities/provider_configuration.py", line 422, in add_or_update_custom_model_credentials provider_model_record, credentials = self.custom_model_credentials_validate(model_type, model, credentials) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/entities/provider_configuration.py", line 402, in custom_model_credentials_validate credentials = model_provider_factory.model_credentials_validate( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/model_runtime/model_providers/model_provider_factory.py", line 191, in model_credentials_validate self.plugin_model_manager.validate_model_credentials( File "/app/api/core/plugin/manager/model.py", line 137, in validate_model_credentials 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 223, in _handle_plugin_daemon_error raise PluginDaemonInternalServerError(description=message) core.plugin.manager.exc.PluginDaemonInternalServerError: PluginDaemonInternalServerError: killed by timeout`
yindo added the bug label 2026-02-16 11:19:47 -05:00
yindo closed this issue 2026-02-16 11:19:47 -05:00
Author
Owner

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

Hey @zanghaibin! I'm here to help you out with the issue you're experiencing. Let's work together to solve this puzzle!

To resolve the timeout error (PluginDaemonInternalServerError: killed by timeout) when adding an Ollama model in Dify v1.1.0 on a CentOS 7.9 environment using Docker, ensure that the Ollama service is accessible from the Docker container. This error often occurs due to network configuration issues.

Here are the steps to address this:

  1. Expose Ollama Service to the Network:

    • Ensure the Ollama service is not bound to localhost but is accessible on the network. Set the OLLAMA_HOST environment variable to 0.0.0.0.
  2. Edit the systemd Service:

    • If Ollama runs as a systemd service, edit the service configuration to set the environment variable:
      systemctl edit ollama.service
      
    • Add the following under the [Service] section:
      [Service]
      Environment="OLLAMA_HOST=0.0.0.0"
      
    • Save the changes and reload the systemd configuration:
      systemctl daemon-reload
      systemctl restart ollama
      
  3. Use host.docker.internal:

    • If the issue persists, replace localhost with host.docker.internal in your service configuration to ensure Docker can access the host network:
      http://host.docker.internal:11434
      

These steps should help resolve the timeout error by ensuring the Ollama service is correctly exposed and accessible from the Docker environment [1].

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 (Mar 20, 2025): <!-- Greeting --> Hey @zanghaibin! I'm here to help you out with the issue you're experiencing. Let's work together to solve this puzzle! <!-- Answer --> To resolve the timeout error (PluginDaemonInternalServerError: killed by timeout) when adding an Ollama model in Dify v1.1.0 on a CentOS 7.9 environment using Docker, ensure that the Ollama service is accessible from the Docker container. This error often occurs due to network configuration issues. Here are the steps to address this: 1. **Expose Ollama Service to the Network:** - Ensure the Ollama service is not bound to `localhost` but is accessible on the network. Set the `OLLAMA_HOST` environment variable to `0.0.0.0`. 2. **Edit the systemd Service:** - If Ollama runs as a systemd service, edit the service configuration to set the environment variable: ```bash systemctl edit ollama.service ``` - Add the following under the `[Service]` section: ```ini [Service] Environment="OLLAMA_HOST=0.0.0.0" ``` - Save the changes and reload the systemd configuration: ```bash systemctl daemon-reload systemctl restart ollama ``` 3. **Use `host.docker.internal`:** - If the issue persists, replace `localhost` with `host.docker.internal` in your service configuration to ensure Docker can access the host network: ```bash http://host.docker.internal:11434 ``` These steps should help resolve the timeout error by ensuring the Ollama service is correctly exposed and accessible from the Docker environment <sup>[[1]](https://github.com/langgenius/dify-docs/blob/main/jp/development/models-integration/ollama.md)</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/b2ba9204-a6e3-4397-a070-bf38af2afc1a?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/b2ba9204-a6e3-4397-a070-bf38af2afc1a?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/b2ba9204-a6e3-4397-a070-bf38af2afc1a?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/b2ba9204-a6e3-4397-a070-bf38af2afc1a?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/b2ba9204-a6e3-4397-a070-bf38af2afc1a?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/b2ba9204-a6e3-4397-a070-bf38af2afc1a?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/b2ba9204-a6e3-4397-a070-bf38af2afc1a?feedback_type=other)</sup>
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-docs-archived#116