Error add model #14381

Closed
opened 2026-02-21 19:17:00 -05:00 by yindo · 5 comments
Owner

Originally created by @MDDTGitHub on GitHub (Jun 3, 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.4.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

#20564

Image Image

✔️ Expected Behavior

I tried to clear the table data provider_model_settings,adding the model again failed

Actual Behavior

I expected to be able to add success models, but I always failed

Originally created by @MDDTGitHub on GitHub (Jun 3, 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.4.1 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce #20564 <img width="1788" alt="Image" src="https://github.com/user-attachments/assets/b52cb488-d875-4fa8-9ea7-282fb6f9c171" /> <img width="1759" alt="Image" src="https://github.com/user-attachments/assets/ccde729e-0c99-4437-ba1a-57747fd5cd5a" /> ### ✔️ Expected Behavior I tried to clear the table data `provider_model_settings`,adding the model again failed ### ❌ Actual Behavior I expected to be able to add success models, but I always failed
yindo added the 🤔 cant-reproduce label 2026-02-21 19:17:00 -05:00
yindo closed this issue 2026-02-21 19:17:00 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jun 3, 2025):

The error “url error, please check url!” with a 400 status code when adding a model in Dify 1.4.1 (self-hosted, Docker) is commonly caused by network or configuration issues, especially with how URLs are set up for model providers in Docker environments.

Here are the most effective troubleshooting steps based on similar cases and the Dify codebase:

  • If your model provider URL uses localhost or 127.0.0.1, change it to http://host.docker.internal (or your host machine’s internal IP). Docker containers cannot resolve localhost as you might expect; this is a frequent cause of connection errors when adding models in self-hosted setups example.
  • Double-check all environment variables in your .env and docker-compose.yaml files. For example, PLUGIN_DAEMON_URL should point to the correct host and port, and SANDBOX_ENABLE_NETWORK must be set to true example.
  • If you have system proxy variables set (HTTP_PROXY, HTTPS_PROXY), try unsetting them in your shell before starting Docker:
    unset HTTP_PROXY
    unset HTTPS_PROXY
    
  • Make sure the model provider settings in Dify are complete and correct, including the API key and any required fields. If you are using a custom LLM, try using the OpenAI provider directly instead of the OpenAI-API-Compatible option, as this has resolved 400 errors for some users example.
  • If you migrated your Docker environment from another network or machine, review all network and storage paths in your configuration files to ensure they are valid in the current environment example.
  • Check the Dify logs (both API and plugin daemon containers) for more detailed error messages that might indicate what is missing or misconfigured.
  • If you are working in an offline or restricted network, verify that your Dify instance can reach any required external endpoints (such as model marketplaces or plugin sources).

These steps address the most common root causes for this error in Dify’s self-hosted Docker deployments. If the problem persists after checking these, please share the exact provider URL you are using (with sensitive info redacted) and any relevant log output for further analysis.

To reply, just mention my name @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

@dosubot[bot] commented on GitHub (Jun 3, 2025): <!-- Answer --> The error “url error, please check url!” with a 400 status code when adding a model in Dify 1.4.1 (self-hosted, Docker) is commonly caused by network or configuration issues, especially with how URLs are set up for model providers in Docker environments. Here are the most effective troubleshooting steps based on similar cases and the Dify codebase: - If your model provider URL uses localhost or 127.0.0.1, change it to http://host.docker.internal (or your host machine’s internal IP). Docker containers cannot resolve localhost as you might expect; this is a frequent cause of connection errors when adding models in self-hosted setups [example](https://github.com/langgenius/dify/issues/14011). - Double-check all environment variables in your .env and docker-compose.yaml files. For example, PLUGIN_DAEMON_URL should point to the correct host and port, and SANDBOX_ENABLE_NETWORK must be set to true [example](https://github.com/langgenius/dify/issues/20325). - If you have system proxy variables set (HTTP_PROXY, HTTPS_PROXY), try unsetting them in your shell before starting Docker: ``` unset HTTP_PROXY unset HTTPS_PROXY ``` - Make sure the model provider settings in Dify are complete and correct, including the API key and any required fields. If you are using a custom LLM, try using the OpenAI provider directly instead of the OpenAI-API-Compatible option, as this has resolved 400 errors for some users [example](https://github.com/langgenius/dify/issues/15495). - If you migrated your Docker environment from another network or machine, review all network and storage paths in your configuration files to ensure they are valid in the current environment [example](https://github.com/langgenius/dify/issues/20325). - Check the Dify logs (both API and plugin daemon containers) for more detailed error messages that might indicate what is missing or misconfigured. - If you are working in an offline or restricted network, verify that your Dify instance can reach any required external endpoints (such as model marketplaces or plugin sources). These steps address the most common root causes for this error in Dify’s self-hosted Docker deployments. If the problem persists after checking these, please share the exact provider URL you are using (with sensitive info redacted) and any relevant log output for further analysis. <!-- Dosu Comment Footer --> *To reply, just mention my name [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/a6eacd3a-6ebe-4412-b61b-72de3100fcc8?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/a6eacd3a-6ebe-4412-b61b-72de3100fcc8?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/a6eacd3a-6ebe-4412-b61b-72de3100fcc8?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/a6eacd3a-6ebe-4412-b61b-72de3100fcc8?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/a6eacd3a-6ebe-4412-b61b-72de3100fcc8?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/a6eacd3a-6ebe-4412-b61b-72de3100fcc8?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/a6eacd3a-6ebe-4412-b61b-72de3100fcc8?feedback_type=other)</sup>&nbsp;&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/20587)
Author
Owner

@MDDTGitHub commented on GitHub (Jun 3, 2025):

api-1            | 2025-06-03 09:13:34.681 ERROR [Dummy-89] [models.py:162] - Failed to save model credentials, tenant_id: 7b4859b8-bf91-46db-bd0a-c492b9be0937, model: qwen-vl-ocr-latest, model_type: llm
api-1            | 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 422, 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 402, 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 191, in model_credentials_validate
api-1            |     self.plugin_model_manager.validate_model_credentials(
api-1            |   File "/app/api/core/plugin/impl/model.py", line 137, in validate_model_credentials
api-1            |     for resp in response:
api-1            |                 ^^^^^^^^
api-1            |   File "/app/api/core/plugin/impl/base.py", line 192, 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/impl/base.py", line 222, in _handle_plugin_daemon_error
api-1            |     raise CredentialsValidateFailedError(error_object.get("message"))
api-1            | core.model_runtime.errors.validate.CredentialsValidateFailedError: url error, please check url!
@MDDTGitHub commented on GitHub (Jun 3, 2025): ``` api-1 | 2025-06-03 09:13:34.681 ERROR [Dummy-89] [models.py:162] - Failed to save model credentials, tenant_id: 7b4859b8-bf91-46db-bd0a-c492b9be0937, model: qwen-vl-ocr-latest, model_type: llm api-1 | 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 422, 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 402, 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 191, in model_credentials_validate api-1 | self.plugin_model_manager.validate_model_credentials( api-1 | File "/app/api/core/plugin/impl/model.py", line 137, in validate_model_credentials api-1 | for resp in response: api-1 | ^^^^^^^^ api-1 | File "/app/api/core/plugin/impl/base.py", line 192, 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/impl/base.py", line 222, in _handle_plugin_daemon_error api-1 | raise CredentialsValidateFailedError(error_object.get("message")) api-1 | core.model_runtime.errors.validate.CredentialsValidateFailedError: url error, please check url! ```
Author
Owner

@crazywoola commented on GitHub (Jun 3, 2025):

Please provide the payload in the web console when add the model.

@crazywoola commented on GitHub (Jun 3, 2025): Please provide the payload in the web console when add the model.
Author
Owner

@MDDTGitHub commented on GitHub (Jun 3, 2025):

{"model":"qwen-vl-ocr-latest","model_type":"llm","credentials":{"context_size":"34816","max_tokens":"34816","function_calling_type":"no_call","dashscope_api_key":"sk-xxxxxxxxxxxxxxxxxx"},"load_balancing":{"enabled":false,"configs":[]}}

The tongyi model on the page does not require a base_url to be configured

docker exec -it docker-api-1 curl -v https://dashscope.aliyuncs.com

  • Trying 8.141.18.184:443...
  • Connected to dashscope.aliyuncs.com (8.141.18.184) port 443 (#0)
  • ALPN: offers h2,http/1.1
  • TLSv1.3 (OUT), TLS handshake, Client hello (1):
  • CAfile: /etc/ssl/certs/ca-certificates.crt
  • CApath: /etc/ssl/certs
  • TLSv1.3 (IN), TLS handshake, Server hello (2):
  • TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
  • TLSv1.3 (IN), TLS handshake, Certificate (11):
  • TLSv1.3 (IN), TLS handshake, CERT verify (15):
  • TLSv1.3 (IN), TLS handshake, Finished (20):
  • TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
  • TLSv1.3 (OUT), TLS handshake, Finished (20):
  • SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
  • ALPN: server accepted h2
  • Server certificate:
  • subject: C=CN; ST=ZheJiang; L=HangZhou; O=Alibaba (China) Technology Co., Ltd.; CN=*.aliyuncs.com
  • start date: Apr 2 07:26:21 2025 GMT
  • expire date: May 4 07:26:20 2026 GMT
  • subjectAltName: host "dashscope.aliyuncs.com" matched cert's "*.aliyuncs.com"
  • issuer: C=BE; O=GlobalSign nv-sa; CN=GlobalSign GCC R3 OV TLS CA 2024
  • SSL certificate verify ok.
  • using HTTP/2
  • h2h3 [:method: GET]
  • h2h3 [:path: /]
  • h2h3 [:scheme: https]
  • h2h3 [:authority: dashscope.aliyuncs.com]
  • h2h3 [user-agent: curl/7.88.1]
  • h2h3 [accept: /]
  • Using Stream ID: 1 (easy handle 0x5583a532d7a0)

GET / HTTP/2
Host: dashscope.aliyuncs.com
user-agent: curl/7.88.1
accept: /

  • TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
  • TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
  • old SSL session ID is stale, removing
    < HTTP/2 404
    < vary: Accept-Encoding
    < date: Wed, 04 Jun 2025 00:56:49 GMT
    < server: istio-envoy
    <
  • Connection #0 to host dashscope.aliyuncs.com left intact
@MDDTGitHub commented on GitHub (Jun 3, 2025): {"model":"qwen-vl-ocr-latest","model_type":"llm","credentials":{"context_size":"34816","max_tokens":"34816","function_calling_type":"no_call","dashscope_api_key":"sk-xxxxxxxxxxxxxxxxxx"},"load_balancing":{"enabled":false,"configs":[]}} The tongyi model on the page does not require a base_url to be configured `docker exec -it docker-api-1 curl -v https://dashscope.aliyuncs.com` * Trying 8.141.18.184:443... * Connected to dashscope.aliyuncs.com (8.141.18.184) port 443 (#0) * ALPN: offers h2,http/1.1 * TLSv1.3 (OUT), TLS handshake, Client hello (1): * CAfile: /etc/ssl/certs/ca-certificates.crt * CApath: /etc/ssl/certs * TLSv1.3 (IN), TLS handshake, Server hello (2): * TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8): * TLSv1.3 (IN), TLS handshake, Certificate (11): * TLSv1.3 (IN), TLS handshake, CERT verify (15): * TLSv1.3 (IN), TLS handshake, Finished (20): * TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1): * TLSv1.3 (OUT), TLS handshake, Finished (20): * SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384 * ALPN: server accepted h2 * Server certificate: * subject: C=CN; ST=ZheJiang; L=HangZhou; O=Alibaba (China) Technology Co., Ltd.; CN=*.aliyuncs.com * start date: Apr 2 07:26:21 2025 GMT * expire date: May 4 07:26:20 2026 GMT * subjectAltName: host "dashscope.aliyuncs.com" matched cert's "*.aliyuncs.com" * issuer: C=BE; O=GlobalSign nv-sa; CN=GlobalSign GCC R3 OV TLS CA 2024 * SSL certificate verify ok. * using HTTP/2 * h2h3 [:method: GET] * h2h3 [:path: /] * h2h3 [:scheme: https] * h2h3 [:authority: dashscope.aliyuncs.com] * h2h3 [user-agent: curl/7.88.1] * h2h3 [accept: */*] * Using Stream ID: 1 (easy handle 0x5583a532d7a0) > GET / HTTP/2 > Host: dashscope.aliyuncs.com > user-agent: curl/7.88.1 > accept: */* > * TLSv1.3 (IN), TLS handshake, Newsession Ticket (4): * TLSv1.3 (IN), TLS handshake, Newsession Ticket (4): * old SSL session ID is stale, removing < HTTP/2 404 < vary: Accept-Encoding < date: Wed, 04 Jun 2025 00:56:49 GMT < server: istio-envoy < * Connection #0 to host dashscope.aliyuncs.com left intact
Author
Owner

@crazywoola commented on GitHub (Jun 22, 2025):

Please upgrade to the latest tongyi plugin to see if it works.

@crazywoola commented on GitHub (Jun 22, 2025): Please upgrade to the latest tongyi plugin to see if it works.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#14381