add rerank model but failed #21441

Closed
opened 2026-02-21 20:12:34 -05:00 by yindo · 4 comments
Owner

Originally created by @fanfan-lucky on GitHub (Jan 5, 2026).

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • 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, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.2.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

when I add a reranker model using plugin "openAI-API-compatible", there is “internal server error”. and the log of docker-api-1 shows:
2026-01-05 06:26:57.074 ERROR [Dummy-634] [app.py:875] - Exception on /console/api/workspaces/current/model-providers/langgenius/openai_api_compatible/openai_api_compatible/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 198, 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 221, in _handle_plugin_daemon_error
raise PluginInvokeError(description=message)
core.plugin.manager.exc.PluginInvokeError: PluginInvokeError: {"args":{},"error_type":"NameError","message":"name 'CredentialsValidateFailedError' is not defined"}

How to resolve it? and sometime reranker model can be added successfully, don't know why.

✔️ Expected Behavior

I can add reranker successfully.

Actual Behavior

No response

Originally created by @fanfan-lucky on GitHub (Jan 5, 2026). ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [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, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.2.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce when I add a reranker model using plugin "openAI-API-compatible", there is “internal server error”. and the log of docker-api-1 shows: 2026-01-05 06:26:57.074 ERROR [Dummy-634] [app.py:875] - Exception on /console/api/workspaces/current/model-providers/langgenius/openai_api_compatible/openai_api_compatible/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 198, 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 221, in _handle_plugin_daemon_error raise PluginInvokeError(description=message) core.plugin.manager.exc.PluginInvokeError: PluginInvokeError: {"args":{},"error_type":"NameError","message":"name 'CredentialsValidateFailedError' is not defined"} How to resolve it? and sometime reranker model can be added successfully, don't know why. ### ✔️ Expected Behavior I can add reranker successfully. ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug🤔 cant-reproduceoutdated labels 2026-02-21 20:12:34 -05:00
yindo closed this issue 2026-02-21 20:12:34 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jan 5, 2026):

The error happens because the plugin manager code tries to raise CredentialsValidateFailedError, but the exception class isn't imported or defined in that scope, causing a NameError. To fix this, make sure that every file or module where CredentialsValidateFailedError is raised or handled has this import:

from core.model_runtime.errors.validate import CredentialsValidateFailedError

This is especially important in the plugin manager code (like api/core/plugin/impl/base.py) where credential validation errors are processed. The intermittent nature of the error likely comes from inconsistent code paths or timing—sometimes the code path that triggers the missing import is hit, sometimes not, depending on how the plugin or validation responds.

If you continue to see credential validation errors after fixing the import, double-check your credential schema, model name, API key, and plugin daemon connectivity. Issues like invalid model names, misconfigured credentials, or network problems can also cause similar errors and intermittent failures when adding models. Updating to the latest compatible plugin version can help if the plugin itself has been patched for related bugs.

References:

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Jan 5, 2026): <!-- Answer --> The error happens because the plugin manager code tries to raise CredentialsValidateFailedError, but the exception class isn't imported or defined in that scope, causing a NameError. To fix this, make sure that every file or module where CredentialsValidateFailedError is raised or handled has this import: ```python from core.model_runtime.errors.validate import CredentialsValidateFailedError ``` This is especially important in the plugin manager code (like api/core/plugin/impl/base.py) where credential validation errors are processed. The intermittent nature of the error likely comes from inconsistent code paths or timing—sometimes the code path that triggers the missing import is hit, sometimes not, depending on how the plugin or validation responds. If you continue to see credential validation errors after fixing the import, double-check your credential schema, model name, API key, and plugin daemon connectivity. Issues like invalid model names, misconfigured credentials, or network problems can also cause similar errors and intermittent failures when adding models. Updating to the latest compatible plugin version can help if the plugin itself has been patched for related bugs. References: - [Exception definition and import location](https://github.com/langgenius/dify/blob/93a85ae98a1c1b8b27bda60d505441300b4bcbff/api/core/model_runtime/errors/validate.py#L1-L6) - [Plugin manager error handling and import](https://github.com/langgenius/dify/blob/93a85ae98a1c1b8b27bda60d505441300b4bcbff/api/core/plugin/impl/base.py#L13-L336) - [Related troubleshooting and causes](https://github.com/langgenius/dify/issues/26043) <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/9bd13c4d-b011-41d8-adbd-30c27f2989a9?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/9bd13c4d-b011-41d8-adbd-30c27f2989a9?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/9bd13c4d-b011-41d8-adbd-30c27f2989a9?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/9bd13c4d-b011-41d8-adbd-30c27f2989a9?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/9bd13c4d-b011-41d8-adbd-30c27f2989a9?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/9bd13c4d-b011-41d8-adbd-30c27f2989a9?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/9bd13c4d-b011-41d8-adbd-30c27f2989a9?feedback_type=other)</sup> [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=The%20error%20happens%20because%20the%20plugin%20manager%20code%20tries%20to%20raise%20CredentialsValidateFailedError%2C%20but%20the%20exception%20class%20isn%27t%20imported%20or%20defined%20in%20that%20scope%2C%20causing%20a%20NameError.%20To%20fix%20this%2C%20make%20sure%20that%20every%20file%20or%20module%20where%20CredentialsValidateFailedError%20is%20raised%20or%20handled%20has%20this%20import%3A%0A%0A%60%60%60python%0Afrom%20core.model_runtime.errors.validate%20import%20CredentialsValidateFailedError%0A%60%60%60%0A%0AThis%20is%20especially%20important%20in%20the%20plugin%20manager%20code%20%28like%20api/core/plugin/impl/base.py%29%20where%20credential%20validation%20errors%20are%20processed.%20The%20intermittent%20nature%20of%20the%20error%20likely%20comes%20from%20inconsistent%20code%20paths%20or%20timing%E2%80%94sometimes%20the%20code%20path%20that%20triggers%20the%20missing%20import%20is%20hit%2C%20sometimes%20not%2C%20depending%20on%20how%20the%20plugin%20or%20validation%20responds.%0A%0AIf%20you%20continue%20to%20see%20credential%20validation%20errors%20after%20fixing%20the%20import%2C%20double-check%20your%20credential%20schema%2C%20model%20name%2C%20API%20key%2C%20and%20plugin%20daemon%20connectivity.%20Issues%20like%20invalid%20model%20names%2C%20misconfigured%20credentials%2C%20or%20network%20problems%20can%20also%20cause%20similar%20errors%20and%20intermittent%20failures%20when%20adding%20models.%20Updating%20to%20the%20latest%20compatible%20plugin%20version%20can%20help%20if%20the%20plugin%20itself%20has%20been%20patched%20for%20related%20bugs.%0A%0AReferences%3A%0A-%20%5BException%20definition%20and%20import%20location%5D%28https%3A//github.com/langgenius/dify/blob/93a85ae98a1c1b8b27bda60d505441300b4bcbff/api/core/model_runtime/errors/validate.py%23L1-L6%29%0A-%20%5BPlugin%20manager%20error%20handling%20and%20import%5D%28https%3A//github.com/langgenius/dify/blob/93a85ae98a1c1b8b27bda60d505441300b4bcbff/api/core/plugin/impl/base.py%23L13-L336%29%0A-%20%5BRelated%20troubleshooting%20and%20causes%5D%28https%3A//github.com/langgenius/dify/issues/26043%29)&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/30558)
Author
Owner

@fanfan-lucky commented on GitHub (Jan 5, 2026):

do I need to compile the code to re-generate image? @dosu

@fanfan-lucky commented on GitHub (Jan 5, 2026): do I need to compile the code to re-generate image? @dosu
Author
Owner

@dosubot[bot] commented on GitHub (Jan 5, 2026):

Yes, you need to rebuild the Docker image and restart the containers after making code changes (like fixing imports) in your self-hosted Dify setup. The official Docker Compose configuration uses pre-built images and does not mount the source code for live updates, so changes to the codebase won't be reflected until you build a new image and redeploy it. This is standard for production Docker deployments—there's no hot-reload or live code mounting mechanism documented for Dify's Docker setup. For reference, see the docker-compose.yaml and README documentation:

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Jan 5, 2026): <!-- Answer --> Yes, you need to rebuild the Docker image and restart the containers after making code changes (like fixing imports) in your self-hosted Dify setup. The official Docker Compose configuration uses pre-built images and does not mount the source code for live updates, so changes to the codebase won't be reflected until you build a new image and redeploy it. This is standard for production Docker deployments—there's no hot-reload or live code mounting mechanism documented for Dify's Docker setup. For reference, see the docker-compose.yaml and README documentation: - [docker-compose.yaml](https://github.com/langgenius/dify/blob/93a85ae98a1c1b8b27bda60d505441300b4bcbff/docker/docker-compose.yaml#L1-L1610) - [docker/README.md](https://github.com/langgenius/dify/blob/93a85ae98a1c1b8b27bda60d505441300b4bcbff/docker/README.md#L3-L162) <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/d7282509-1a4f-48b2-bb4a-e66275b90275?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/d7282509-1a4f-48b2-bb4a-e66275b90275?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/d7282509-1a4f-48b2-bb4a-e66275b90275?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/d7282509-1a4f-48b2-bb4a-e66275b90275?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/d7282509-1a4f-48b2-bb4a-e66275b90275?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/d7282509-1a4f-48b2-bb4a-e66275b90275?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/d7282509-1a4f-48b2-bb4a-e66275b90275?feedback_type=other)</sup> [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=Yes%2C%20you%20need%20to%20rebuild%20the%20Docker%20image%20and%20restart%20the%20containers%20after%20making%20code%20changes%20%28like%20fixing%20imports%29%20in%20your%20self-hosted%20Dify%20setup.%20The%20official%20Docker%20Compose%20configuration%20uses%20pre-built%20images%20and%20does%20not%20mount%20the%20source%20code%20for%20live%20updates%2C%20so%20changes%20to%20the%20codebase%20won%27t%20be%20reflected%20until%20you%20build%20a%20new%20image%20and%20redeploy%20it.%20This%20is%20standard%20for%20production%20Docker%20deployments%E2%80%94there%27s%20no%20hot-reload%20or%20live%20code%20mounting%20mechanism%20documented%20for%20Dify%27s%20Docker%20setup.%20For%20reference%2C%20see%20the%20docker-compose.yaml%20and%20README%20documentation%3A%0A-%20%5Bdocker-compose.yaml%5D%28https%3A//github.com/langgenius/dify/blob/93a85ae98a1c1b8b27bda60d505441300b4bcbff/docker/docker-compose.yaml%23L1-L1610%29%0A-%20%5Bdocker/README.md%5D%28https%3A//github.com/langgenius/dify/blob/93a85ae98a1c1b8b27bda60d505441300b4bcbff/docker/README.md%23L3-L162%29)&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/30558)
Author
Owner

@crazywoola commented on GitHub (Jan 5, 2026):

Sorry the version is too old and we do not want to spend time on it. Please upgrade to the latest version.

@crazywoola commented on GitHub (Jan 5, 2026): Sorry the version is too old and we do not want to spend time on it. Please upgrade to 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#21441