Error adding model #14373

Closed
opened 2026-02-21 19:16:58 -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.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Request

URL
/console/api/workspaces/current/model-providers/langgenius/tongyi/tongyi/models
Request Type
POST
Status 400 BAD REQUEST

Response

{
"code": "invalid_param",
"message": "url error, please check url\uff01",
"status": 400
}

error logs:

api-1 | 2025-06-03 12:30:27.680 ERROR [Dummy-88] [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!
nginx-1 | xx.xx.xx.xx - - [03/Jun/2025:12:30:27 +0000] "POST /console/api/workspaces/current/model-providers/langgenius/tongyi/tongyi/models HTTP/1.1" 400 89 "http://xx.xx.xx.xx/plugins?category=discover" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36 Edg/137.0.0.0" "-"

✔️ Expected Behavior

No response

Actual Behavior

No response

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.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce ## Request URL /console/api/workspaces/current/model-providers/langgenius/tongyi/tongyi/models Request Type POST Status 400 BAD REQUEST ## Response { "code": "invalid_param", "message": "url error, please check url\uff01", "status": 400 } ## error logs: api-1 | 2025-06-03 12:30:27.680 ERROR [Dummy-88] [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! nginx-1 | xx.xx.xx.xx - - [03/Jun/2025:12:30:27 +0000] "POST /console/api/workspaces/current/model-providers/langgenius/tongyi/tongyi/models HTTP/1.1" 400 89 "http://xx.xx.xx.xx/plugins?category=discover" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36 Edg/137.0.0.0" "-" ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo added the 🤔 cant-reproduce label 2026-02-21 19:16:58 -05:00
yindo closed this issue 2026-02-21 19:16:58 -05:00
Author
Owner

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

Request param:

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

@MDDTGitHub commented on GitHub (Jun 3, 2025): # Request param: {"model":"qwen-vl-ocr-latest","model_type":"llm","credentials":{"context_size":"8192","max_tokens":"8192","function_calling_type":"no_call","dashscope_api_key":"xxx"},"load_balancing":{"enabled":false,"configs":[]}}
Author
Owner

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

The "url error, please check url" message during model addition is likely caused by a missing or incorrectly formatted URL in your model credentials or configuration. Based on the code and similar issues, Dify expects certain credential fields (such as API endpoints or base URLs) to be present and properly formatted, often including the protocol (http:// or https://). However, your provided credentials do not include any URL fields—only context size, max tokens, function calling type, and dashscope_api_key.

To resolve this, check the following:

  • If your model provider (in this case, Tongyi/Qwen) requires an API base URL or endpoint in the credentials, ensure you include it and that it starts with http:// or https://. For example:
    "api_base_url": "https://dashscope.aliyuncs.com/api/v1/services/aigc/text-generation/generation"
  • If you have any URLs in your .env or Docker environment variables, make sure they also include the protocol (http:// or https://), as missing protocols have caused similar 400 errors for other users self-hosting Dify via Docker source.

If you are unsure which credential fields are required, check the plugin or provider documentation for Tongyi/Qwen, or look for a field like api_base_url or endpoint in the model credential schema. The backend does not enforce URL validation beyond checking for a non-empty string, so a missing or malformed URL will trigger this error source.

Update your request parameters to include the required URL field, and ensure all URLs are complete and correctly formatted. If the error persists, double-check your provider's credential requirements.

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 "url error, please check url" message during model addition is likely caused by a missing or incorrectly formatted URL in your model credentials or configuration. Based on the code and similar issues, Dify expects certain credential fields (such as API endpoints or base URLs) to be present and properly formatted, often including the protocol (http:// or https://). However, your provided credentials do not include any URL fields—only context size, max tokens, function calling type, and dashscope_api_key. To resolve this, check the following: - If your model provider (in this case, Tongyi/Qwen) requires an API base URL or endpoint in the credentials, ensure you include it and that it starts with http:// or https://. For example: `"api_base_url": "https://dashscope.aliyuncs.com/api/v1/services/aigc/text-generation/generation"` - If you have any URLs in your .env or Docker environment variables, make sure they also include the protocol (http:// or https://), as missing protocols have caused similar 400 errors for other users self-hosting Dify via Docker [source](https://github.com/langgenius/dify/issues/16782). If you are unsure which credential fields are required, check the plugin or provider documentation for Tongyi/Qwen, or look for a field like `api_base_url` or `endpoint` in the model credential schema. The backend does not enforce URL validation beyond checking for a non-empty string, so a missing or malformed URL will trigger this error [source](https://github.com/langgenius/dify/blob/c29cb503beb3d1b440a7faef680ddadff4be5ecd/api/core/model_runtime/schema_validators/common_validator.py). Update your request parameters to include the required URL field, and ensure all URLs are complete and correctly formatted. If the error persists, double-check your provider's credential requirements. <!-- 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/8fda2bde-f970-40a3-ae18-1a0feaa5bc44?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/8fda2bde-f970-40a3-ae18-1a0feaa5bc44?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/8fda2bde-f970-40a3-ae18-1a0feaa5bc44?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/8fda2bde-f970-40a3-ae18-1a0feaa5bc44?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/8fda2bde-f970-40a3-ae18-1a0feaa5bc44?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/8fda2bde-f970-40a3-ae18-1a0feaa5bc44?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/8fda2bde-f970-40a3-ae18-1a0feaa5bc44?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/20564)
Author
Owner

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

Sorry, but can not reproduce in our latest version. Please check the plugin version as well.

@crazywoola commented on GitHub (Jun 3, 2025): Sorry, but can not reproduce in our latest version. Please check the plugin version as well.
Author
Owner

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

Image

I updated to the latest version 1.4.1, tried again, but still reported an error. The page did not have base_url information configured

@MDDTGitHub commented on GitHub (Jun 3, 2025): <img width="1213" alt="Image" src="https://github.com/user-attachments/assets/e726073d-a735-47a9-9a38-c89492f0725b" /> I updated to the latest version 1.4.1, tried again, but still reported an error. The page did not have base_url information configured
Author
Owner

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

Image

Sorry, but can not reproduce in our latest version. Please check the plugin version as well.

@crazywoola
The version I installed is the latest version!

@MDDTGitHub commented on GitHub (Jun 3, 2025): <img width="1798" alt="Image" src="https://github.com/user-attachments/assets/283770c8-8cde-4f3f-8e73-926606f9f98b" /> > Sorry, but can not reproduce in our latest version. Please check the plugin version as well. @crazywoola The version I installed is the latest version!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#14373