An error occurred during credentials validation: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')) #4754

Closed
opened 2026-02-21 18:07:53 -05:00 by yindo · 1 comment
Owner

Originally created by @liuming-dev on GitHub (Jul 24, 2024).

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).
  • 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.6.15

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Request ollama api direct via curl is ok
image

but get an error, when add ollama model in dify
image

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @liuming-dev on GitHub (Jul 24, 2024). ### 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] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.6.15 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce Request ollama api direct via `curl` is ok ![image](https://github.com/user-attachments/assets/ce5677aa-57a3-4da4-a44d-8a8fba87ebf2) but get an error, when add ollama model in dify ![image](https://github.com/user-attachments/assets/81dad965-59ca-44bd-aa3d-ea03ec8f1e27) ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug label 2026-02-21 18:07:53 -05:00
yindo closed this issue 2026-02-21 18:07:53 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jul 24, 2024):

@liuming-dev Hello there! I'm here to help you with any bugs, questions, or contributions you have for the repository. Let's tackle this issue together!

To resolve the "Connection aborted; RemoteDisconnected('Remote end closed connection without response')" error when adding an Ollama model in Dify, you need to ensure that the Ollama service is accessible from the Dify environment. This issue often arises when using Docker, as localhost refers to the container itself rather than the host machine or other containers.

Here are the steps to resolve this issue:

  1. Expose the Ollama Service to the Network:

    • If you are using Docker, replace localhost with host.docker.internal in the service URL. This allows the Docker container to access the host machine's network.
    http://host.docker.internal:11434
    
  2. Set Environment Variables:

    • On macOS, use launchctl to set the OLLAMA_HOST environment variable:

      launchctl setenv OLLAMA_HOST "0.0.0.0"
      
    • On Linux, edit the systemd service to set the OLLAMA_HOST environment variable:

      [Service]
      Environment="OLLAMA_HOST=0.0.0.0"
      

      Then reload systemd and restart Ollama:

      systemctl daemon-reload
      systemctl restart ollama
      
    • On Windows, set the OLLAMA_HOST environment variable through the system environment variables settings:

      1. Quit Ollama by clicking on it in the taskbar.
      2. Edit system environment variables from the control panel.
      3. Edit or create a new variable for your user account for OLLAMA_HOST.
      4. Click OK/Apply to save.
      5. Run ollama from a new terminal window.
  3. Configure Dify to Connect to Ollama:

    • In Dify, navigate to Settings > Model Providers > Ollama and enter the following details:

      • Model Name: llava (or the name of the model you are using)
      • Base URL: http://<your-ollama-endpoint-domain>:11434 (use the accessible address of the Ollama service, such as http://192.168.1.100:11434 for local network or http://172.17.0.1:11434 for Docker host machine)
      • Model Type: Conversation
      • Model Context Length: 4096 (default value if unknown)
      • Max Token Limit: 4096 (same as context length if unspecified)
      • Vision Enabled: Yes (if the model supports image understanding, e.g., llava)

By following these steps, you should be able to resolve the connection issue and successfully integrate the Ollama model in Dify.

For more detailed instructions, you can refer to the Ollama documentation and the Dify guide on integrating Ollama models [1][2][3].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Jul 24, 2024): <!-- Greeting --> @liuming-dev Hello there! I'm here to help you with any bugs, questions, or contributions you have for the repository. Let's tackle this issue together! <!-- Answer --> To resolve the "Connection aborted; RemoteDisconnected('Remote end closed connection without response')" error when adding an Ollama model in Dify, you need to ensure that the Ollama service is accessible from the Dify environment. This issue often arises when using Docker, as `localhost` refers to the container itself rather than the host machine or other containers. Here are the steps to resolve this issue: 1. **Expose the Ollama Service to the Network:** - If you are using Docker, replace `localhost` with `host.docker.internal` in the service URL. This allows the Docker container to access the host machine's network. ```bash http://host.docker.internal:11434 ``` 2. **Set Environment Variables:** - On macOS, use `launchctl` to set the `OLLAMA_HOST` environment variable: ```bash launchctl setenv OLLAMA_HOST "0.0.0.0" ``` - On Linux, edit the systemd service to set the `OLLAMA_HOST` environment variable: ```ini [Service] Environment="OLLAMA_HOST=0.0.0.0" ``` Then reload `systemd` and restart Ollama: ```bash systemctl daemon-reload systemctl restart ollama ``` - On Windows, set the `OLLAMA_HOST` environment variable through the system environment variables settings: 1. Quit Ollama by clicking on it in the taskbar. 2. Edit system environment variables from the control panel. 3. Edit or create a new variable for your user account for `OLLAMA_HOST`. 4. Click OK/Apply to save. 5. Run `ollama` from a new terminal window. 3. **Configure Dify to Connect to Ollama:** - In Dify, navigate to `Settings > Model Providers > Ollama` and enter the following details: - **Model Name:** `llava` (or the name of the model you are using) - **Base URL:** `http://<your-ollama-endpoint-domain>:11434` (use the accessible address of the Ollama service, such as `http://192.168.1.100:11434` for local network or `http://172.17.0.1:11434` for Docker host machine) - **Model Type:** `Conversation` - **Model Context Length:** `4096` (default value if unknown) - **Max Token Limit:** `4096` (same as context length if unspecified) - **Vision Enabled:** `Yes` (if the model supports image understanding, e.g., `llava`) By following these steps, you should be able to resolve the connection issue and successfully integrate the Ollama model in Dify. For more detailed instructions, you can refer to the [Ollama documentation](https://github.com/jmorganca/ollama) and the [Dify guide on integrating Ollama models](https://github.com/dify-ai/docs.dify.ai/blob/main/zh_CN/guides/model-configuration/ollama.md) <sup>[[1]](https://github.com/langgenius/dify-docs/blob/main/en/guides/model-configuration/ollama.md)</sup><sup>[[2]](https://github.com/langgenius/dify-docs/blob/main/jp/guides/model-configuration/ollama.md)</sup><sup>[[3]](https://github.com/langgenius/dify-docs/blob/main/zh_CN/guides/model-configuration/ollama.md)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#4754