Dify1.0.0 deployed by Docker reports an error when configuring the Ollama model #8843

Closed
opened 2026-02-21 18:28:06 -05:00 by yindo · 6 comments
Owner

Originally created by @Twinhead880 on GitHub (Mar 2, 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.0.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Dify1.0.0 deployed by Docker reports an error when configuring the Olama model:

Traceback (most recent call last):
api-1  |   File "/app/api/controllers/console/workspace/models.py", line 154, in post
api-1  |     model_provider_service.save_model_credentials(
api-1  |   File "/app/api/services/model_provider_service.py", line 237, in save_model_credentials
api-1  |     provider_configuration.add_or_update_custom_model_credentials(
api-1  |   File "/app/api/core/entities/provider_configuration.py", line 406, in add_or_update_custom_model_credentials
api-1  |     provider_model_record, credentials = self.custom_model_credentials_validate(model_type, model, credentials)
api-1  |                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
api-1  |   File "/app/api/core/entities/provider_configuration.py", line 386, in custom_model_credentials_validate
api-1  |     credentials = model_provider_factory.model_credentials_validate(
api-1  |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
api-1  |   File "/app/api/core/model_runtime/model_providers/model_provider_factory.py", line 190, in model_credentials_validate
api-1  |     self.plugin_model_manager.validate_model_credentials(
api-1  |   File "/app/api/core/plugin/manager/model.py", line 137, in validate_model_credentials
api-1  |     for resp in response:
api-1  |                 ^^^^^^^^
api-1  |   File "/app/api/core/plugin/manager/base.py", line 189, in _request_with_plugin_daemon_response_stream
api-1  |     self._handle_plugin_daemon_error(error.error_type, error.message)
api-1  |   File "/app/api/core/plugin/manager/base.py", line 219, in _handle_plugin_daemon_error
api-1  |     raise CredentialsValidateFailedError(error_object.get("message"))
api-1  | core.model_runtime.errors.validate.CredentialsValidateFailedError: An error occurred during credentials validation: can't start new thread

✔️ Expected Behavior

Dify1.0.0 deployed by Docker reports an error when configuring the Olama model:

Traceback (most recent call last):
api-1  |   File "/app/api/controllers/console/workspace/models.py", line 154, in post
api-1  |     model_provider_service.save_model_credentials(
api-1  |   File "/app/api/services/model_provider_service.py", line 237, in save_model_credentials
api-1  |     provider_configuration.add_or_update_custom_model_credentials(
api-1  |   File "/app/api/core/entities/provider_configuration.py", line 406, in add_or_update_custom_model_credentials
api-1  |     provider_model_record, credentials = self.custom_model_credentials_validate(model_type, model, credentials)
api-1  |                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
api-1  |   File "/app/api/core/entities/provider_configuration.py", line 386, in custom_model_credentials_validate
api-1  |     credentials = model_provider_factory.model_credentials_validate(
api-1  |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
api-1  |   File "/app/api/core/model_runtime/model_providers/model_provider_factory.py", line 190, in model_credentials_validate
api-1  |     self.plugin_model_manager.validate_model_credentials(
api-1  |   File "/app/api/core/plugin/manager/model.py", line 137, in validate_model_credentials
api-1  |     for resp in response:
api-1  |                 ^^^^^^^^
api-1  |   File "/app/api/core/plugin/manager/base.py", line 189, in _request_with_plugin_daemon_response_stream
api-1  |     self._handle_plugin_daemon_error(error.error_type, error.message)
api-1  |   File "/app/api/core/plugin/manager/base.py", line 219, in _handle_plugin_daemon_error
api-1  |     raise CredentialsValidateFailedError(error_object.get("message"))
api-1  | core.model_runtime.errors.validate.CredentialsValidateFailedError: An error occurred during credentials validation: can't start new thread

Actual Behavior

Dify1.0.0 deployed by Docker reports an error when configuring the Olama model:

Traceback (most recent call last):
api-1  |   File "/app/api/controllers/console/workspace/models.py", line 154, in post
api-1  |     model_provider_service.save_model_credentials(
api-1  |   File "/app/api/services/model_provider_service.py", line 237, in save_model_credentials
api-1  |     provider_configuration.add_or_update_custom_model_credentials(
api-1  |   File "/app/api/core/entities/provider_configuration.py", line 406, in add_or_update_custom_model_credentials
api-1  |     provider_model_record, credentials = self.custom_model_credentials_validate(model_type, model, credentials)
api-1  |                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
api-1  |   File "/app/api/core/entities/provider_configuration.py", line 386, in custom_model_credentials_validate
api-1  |     credentials = model_provider_factory.model_credentials_validate(
api-1  |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
api-1  |   File "/app/api/core/model_runtime/model_providers/model_provider_factory.py", line 190, in model_credentials_validate
api-1  |     self.plugin_model_manager.validate_model_credentials(
api-1  |   File "/app/api/core/plugin/manager/model.py", line 137, in validate_model_credentials
api-1  |     for resp in response:
api-1  |                 ^^^^^^^^
api-1  |   File "/app/api/core/plugin/manager/base.py", line 189, in _request_with_plugin_daemon_response_stream
api-1  |     self._handle_plugin_daemon_error(error.error_type, error.message)
api-1  |   File "/app/api/core/plugin/manager/base.py", line 219, in _handle_plugin_daemon_error
api-1  |     raise CredentialsValidateFailedError(error_object.get("message"))
api-1  | core.model_runtime.errors.validate.CredentialsValidateFailedError: An error occurred during credentials validation: can't start new thread
Originally created by @Twinhead880 on GitHub (Mar 2, 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.0.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce Dify1.0.0 deployed by Docker reports an error when configuring the Olama model: ``` Traceback (most recent call last): api-1 | File "/app/api/controllers/console/workspace/models.py", line 154, in post api-1 | model_provider_service.save_model_credentials( api-1 | File "/app/api/services/model_provider_service.py", line 237, in save_model_credentials api-1 | provider_configuration.add_or_update_custom_model_credentials( api-1 | File "/app/api/core/entities/provider_configuration.py", line 406, in add_or_update_custom_model_credentials api-1 | provider_model_record, credentials = self.custom_model_credentials_validate(model_type, model, credentials) api-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ api-1 | File "/app/api/core/entities/provider_configuration.py", line 386, in custom_model_credentials_validate api-1 | credentials = model_provider_factory.model_credentials_validate( api-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ api-1 | File "/app/api/core/model_runtime/model_providers/model_provider_factory.py", line 190, in model_credentials_validate api-1 | self.plugin_model_manager.validate_model_credentials( api-1 | File "/app/api/core/plugin/manager/model.py", line 137, in validate_model_credentials api-1 | for resp in response: api-1 | ^^^^^^^^ api-1 | File "/app/api/core/plugin/manager/base.py", line 189, in _request_with_plugin_daemon_response_stream api-1 | self._handle_plugin_daemon_error(error.error_type, error.message) api-1 | File "/app/api/core/plugin/manager/base.py", line 219, in _handle_plugin_daemon_error api-1 | raise CredentialsValidateFailedError(error_object.get("message")) api-1 | core.model_runtime.errors.validate.CredentialsValidateFailedError: An error occurred during credentials validation: can't start new thread ``` ### ✔️ Expected Behavior Dify1.0.0 deployed by Docker reports an error when configuring the Olama model: ``` Traceback (most recent call last): api-1 | File "/app/api/controllers/console/workspace/models.py", line 154, in post api-1 | model_provider_service.save_model_credentials( api-1 | File "/app/api/services/model_provider_service.py", line 237, in save_model_credentials api-1 | provider_configuration.add_or_update_custom_model_credentials( api-1 | File "/app/api/core/entities/provider_configuration.py", line 406, in add_or_update_custom_model_credentials api-1 | provider_model_record, credentials = self.custom_model_credentials_validate(model_type, model, credentials) api-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ api-1 | File "/app/api/core/entities/provider_configuration.py", line 386, in custom_model_credentials_validate api-1 | credentials = model_provider_factory.model_credentials_validate( api-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ api-1 | File "/app/api/core/model_runtime/model_providers/model_provider_factory.py", line 190, in model_credentials_validate api-1 | self.plugin_model_manager.validate_model_credentials( api-1 | File "/app/api/core/plugin/manager/model.py", line 137, in validate_model_credentials api-1 | for resp in response: api-1 | ^^^^^^^^ api-1 | File "/app/api/core/plugin/manager/base.py", line 189, in _request_with_plugin_daemon_response_stream api-1 | self._handle_plugin_daemon_error(error.error_type, error.message) api-1 | File "/app/api/core/plugin/manager/base.py", line 219, in _handle_plugin_daemon_error api-1 | raise CredentialsValidateFailedError(error_object.get("message")) api-1 | core.model_runtime.errors.validate.CredentialsValidateFailedError: An error occurred during credentials validation: can't start new thread ``` ### ❌ Actual Behavior Dify1.0.0 deployed by Docker reports an error when configuring the Olama model: ``` Traceback (most recent call last): api-1 | File "/app/api/controllers/console/workspace/models.py", line 154, in post api-1 | model_provider_service.save_model_credentials( api-1 | File "/app/api/services/model_provider_service.py", line 237, in save_model_credentials api-1 | provider_configuration.add_or_update_custom_model_credentials( api-1 | File "/app/api/core/entities/provider_configuration.py", line 406, in add_or_update_custom_model_credentials api-1 | provider_model_record, credentials = self.custom_model_credentials_validate(model_type, model, credentials) api-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ api-1 | File "/app/api/core/entities/provider_configuration.py", line 386, in custom_model_credentials_validate api-1 | credentials = model_provider_factory.model_credentials_validate( api-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ api-1 | File "/app/api/core/model_runtime/model_providers/model_provider_factory.py", line 190, in model_credentials_validate api-1 | self.plugin_model_manager.validate_model_credentials( api-1 | File "/app/api/core/plugin/manager/model.py", line 137, in validate_model_credentials api-1 | for resp in response: api-1 | ^^^^^^^^ api-1 | File "/app/api/core/plugin/manager/base.py", line 189, in _request_with_plugin_daemon_response_stream api-1 | self._handle_plugin_daemon_error(error.error_type, error.message) api-1 | File "/app/api/core/plugin/manager/base.py", line 219, in _handle_plugin_daemon_error api-1 | raise CredentialsValidateFailedError(error_object.get("message")) api-1 | core.model_runtime.errors.validate.CredentialsValidateFailedError: An error occurred during credentials validation: can't start new thread ```
yindo added the 🐞 bug label 2026-02-21 18:28:06 -05:00
yindo closed this issue 2026-02-21 18:28:06 -05:00
Author
Owner

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

The "can't start new thread" error in Dify 1.0.0 when configuring the Olama model is likely due to insufficient system resources. To resolve this, you should:

  1. Increase the host memory to 24GB (from the original 8GB).
  2. Increase the system's threads-max limit to a much higher value, such as 752215.

Additionally, ensure that the Ollama service is properly configured to be accessible from the Docker environment. This may involve adjusting the Ollama service's network settings. For example, on macOS, you can set the OLLAMA_HOST environment variable to 0.0.0.0 using launchctl, and on Linux, you can edit the ollama.service file to include Environment="OLLAMA_HOST=0.0.0.0". On Windows, ensure that the environment variables are correctly set through the system settings [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 2, 2025): <!-- Answer --> The "can't start new thread" error in Dify 1.0.0 when configuring the Olama model is likely due to insufficient system resources. To resolve this, you should: 1. Increase the host memory to 24GB (from the original 8GB). 2. Increase the system's threads-max limit to a much higher value, such as 752215. Additionally, ensure that the Ollama service is properly configured to be accessible from the Docker environment. This may involve adjusting the Ollama service's network settings. For example, on macOS, you can set the `OLLAMA_HOST` environment variable to `0.0.0.0` using `launchctl`, and on Linux, you can edit the `ollama.service` file to include `Environment="OLLAMA_HOST=0.0.0.0"`. On Windows, ensure that the environment variables are correctly set through the system settings <sup>[[1]](https://github.com/langgenius/dify/issues/14626)</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/781e4ffc-bdce-471e-babc-8fe2405460a0?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/781e4ffc-bdce-471e-babc-8fe2405460a0?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/781e4ffc-bdce-471e-babc-8fe2405460a0?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/781e4ffc-bdce-471e-babc-8fe2405460a0?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/781e4ffc-bdce-471e-babc-8fe2405460a0?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/781e4ffc-bdce-471e-babc-8fe2405460a0?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/781e4ffc-bdce-471e-babc-8fe2405460a0?feedback_type=other)</sup>
Author
Owner

@Twinhead880 commented on GitHub (Mar 2, 2025):

Increase the host memory to 24GB (from the original 8GB).
Increase the system's threads-max limit to a much higher value, such as 752215.

How to set up?
@dosu

@Twinhead880 commented on GitHub (Mar 2, 2025): Increase the host memory to 24GB (from the original 8GB). Increase the system's threads-max limit to a much higher value, such as 752215. How to set up? @dosu
Author
Owner

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

To increase the host memory and system's threads-max limit, follow these steps:

Increase Host Memory

macOS

  1. Open Docker Desktop.
  2. Go to Settings > Resources.
  3. Adjust the Memory slider to 24GB.
  4. Click Apply & Restart to save the changes.

Windows

  1. Open Docker Desktop.
  2. Go to Settings > Resources.
  3. Adjust the Memory slider to 24GB.
  4. Click Apply & Restart to save the changes.

Increase System's Threads-Max Limit

Linux

  1. Open a terminal.
  2. Edit the /etc/sysctl.conf file:
    sudo nano /etc/sysctl.conf
    
  3. Add or modify the following line to set a higher threads-max limit:
    kernel.threads-max = 752215
    
  4. Save the file and exit the editor.
  5. Apply the changes by running:
    sudo sysctl -p
    

These steps will help you increase the host memory and adjust the system's threads-max limit to support Dify's requirements.

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 2, 2025): <!-- Answer --> To increase the host memory and system's threads-max limit, follow these steps: ### Increase Host Memory #### macOS 1. Open Docker Desktop. 2. Go to **Settings** > **Resources**. 3. Adjust the **Memory** slider to 24GB. 4. Click **Apply & Restart** to save the changes. #### Windows 1. Open Docker Desktop. 2. Go to **Settings** > **Resources**. 3. Adjust the **Memory** slider to 24GB. 4. Click **Apply & Restart** to save the changes. ### Increase System's Threads-Max Limit #### Linux 1. Open a terminal. 2. Edit the `/etc/sysctl.conf` file: ```bash sudo nano /etc/sysctl.conf ``` 3. Add or modify the following line to set a higher threads-max limit: ```bash kernel.threads-max = 752215 ``` 4. Save the file and exit the editor. 5. Apply the changes by running: ```bash sudo sysctl -p ``` These steps will help you increase the host memory and adjust the system's threads-max limit to support Dify's requirements. <!-- 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/4ea45d54-f32e-4074-ab31-afbdd60549d9?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/4ea45d54-f32e-4074-ab31-afbdd60549d9?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/4ea45d54-f32e-4074-ab31-afbdd60549d9?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/4ea45d54-f32e-4074-ab31-afbdd60549d9?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/4ea45d54-f32e-4074-ab31-afbdd60549d9?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/4ea45d54-f32e-4074-ab31-afbdd60549d9?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/4ea45d54-f32e-4074-ab31-afbdd60549d9?feedback_type=other)</sup>
Author
Owner

@Twinhead880 commented on GitHub (Mar 2, 2025):

I deployed it on Ubuntu 22.04 in WSL2, should it be set up like this?

@dosu

@Twinhead880 commented on GitHub (Mar 2, 2025): I deployed it on Ubuntu 22.04 in WSL2, should it be set up like this? @dosu
Author
Owner

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

For Ubuntu 22.04 in WSL2, you can adjust the memory allocation and system's threads-max limit as follows:

Increase Host Memory in WSL2

  1. Open your Windows home directory and create or edit a .wslconfig file:
    C:\Users\<YourUsername>\.wslconfig
    
  2. Add or modify the following configuration to allocate 24GB of memory:
    [wsl2]
    memory=24GB
    
  3. Restart WSL2 by running the following command in PowerShell or Command Prompt:
    wsl --shutdown
    

Increase System's Threads-Max Limit in WSL2

  1. Open a terminal in your WSL2 Ubuntu environment.
  2. Edit the /etc/sysctl.conf file:
    sudo nano /etc/sysctl.conf
    
  3. Add or modify the following line to set a higher threads-max limit:
    kernel.threads-max = 752215
    
  4. Save the file and exit the editor.
  5. Apply the changes by running:
    sudo sysctl -p
    

These steps will help configure your WSL2 environment to better support Dify's requirements.

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 2, 2025): <!-- Answer --> For Ubuntu 22.04 in WSL2, you can adjust the memory allocation and system's threads-max limit as follows: ### Increase Host Memory in WSL2 1. Open your Windows home directory and create or edit a `.wslconfig` file: ```plaintext C:\Users\<YourUsername>\.wslconfig ``` 2. Add or modify the following configuration to allocate 24GB of memory: ```ini [wsl2] memory=24GB ``` 3. Restart WSL2 by running the following command in PowerShell or Command Prompt: ```bash wsl --shutdown ``` ### Increase System's Threads-Max Limit in WSL2 1. Open a terminal in your WSL2 Ubuntu environment. 2. Edit the `/etc/sysctl.conf` file: ```bash sudo nano /etc/sysctl.conf ``` 3. Add or modify the following line to set a higher threads-max limit: ```bash kernel.threads-max = 752215 ``` 4. Save the file and exit the editor. 5. Apply the changes by running: ```bash sudo sysctl -p ``` These steps will help configure your WSL2 environment to better support Dify's requirements. <!-- 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/c298bd33-58c4-4ba8-9f9c-29d52e2d4d1c?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/c298bd33-58c4-4ba8-9f9c-29d52e2d4d1c?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/c298bd33-58c4-4ba8-9f9c-29d52e2d4d1c?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/c298bd33-58c4-4ba8-9f9c-29d52e2d4d1c?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/c298bd33-58c4-4ba8-9f9c-29d52e2d4d1c?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/c298bd33-58c4-4ba8-9f9c-29d52e2d4d1c?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/c298bd33-58c4-4ba8-9f9c-29d52e2d4d1c?feedback_type=other)</sup>
Author
Owner

@crazywoola commented on GitHub (Mar 2, 2025):

Duplicated https://github.com/langgenius/dify/issues/14626

@crazywoola commented on GitHub (Mar 2, 2025): Duplicated https://github.com/langgenius/dify/issues/14626
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#8843