Add rerank model meet error #528

Closed
opened 2026-02-16 10:19:39 -05:00 by yindo · 3 comments
Owner

Originally created by @Jimmy-L99 on GitHub (Aug 6, 2025).

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

dify v1.7.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Dify v1.7.1
OpenAI-API-compatible v0.0.19

The rerank model was deploy by sglang.
When I add rerank model, the error show:

list indices must be integers or slices, not str

Image Image

Then I docker logs -f docker-api-1 meet the error as follow:

2025-08-06 06:16:49.927 ERROR [Dummy-16] [models.py:163] - Failed to save model credentials, tenant_id: 1cabefe8-834c-4f8f-8ad5-3bd8fc8e467a, model: /models/bge-reranker-v2-m3, model_type: rerank
Traceback (most recent call last):
  File "/app/api/controllers/console/workspace/models.py", line 155, 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/impl/model.py", line 137, in validate_model_credentials
    for resp in response:
                ^^^^^^^^
  File "/app/api/core/plugin/impl/base.py", line 211, in _request_with_plugin_daemon_response_stream
    self._handle_plugin_daemon_error(error.error_type, error.message)
  File "/app/api/core/plugin/impl/base.py", line 241, in _handle_plugin_daemon_error
    raise CredentialsValidateFailedError(error_object.get("message"))
core.model_runtime.errors.validate.CredentialsValidateFailedError: list indices must be integers or slices, not str

But if I use vLLM to deploy rerank model, it can be add in dify normally. Why?
What should I do to fix this error?

✔️ Expected Behavior

Can normally add the rerank model.

Actual Behavior

No response

Originally created by @Jimmy-L99 on GitHub (Aug 6, 2025). ### 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 dify v1.7.1 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce ``` Dify v1.7.1 OpenAI-API-compatible v0.0.19 ``` The rerank model was deploy by sglang. When I add rerank model, the error show: `list indices must be integers or slices, not str` <img width="613" height="731" alt="Image" src="https://github.com/user-attachments/assets/8d406b39-5830-448c-a2bd-b0f18f076c90" /> <img width="360" height="62" alt="Image" src="https://github.com/user-attachments/assets/7d47e172-fc40-4e76-bbb1-db298b9e7e1a" /> Then I `docker logs -f docker-api-1` meet the error as follow: ``` 2025-08-06 06:16:49.927 ERROR [Dummy-16] [models.py:163] - Failed to save model credentials, tenant_id: 1cabefe8-834c-4f8f-8ad5-3bd8fc8e467a, model: /models/bge-reranker-v2-m3, model_type: rerank Traceback (most recent call last): File "/app/api/controllers/console/workspace/models.py", line 155, 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/impl/model.py", line 137, in validate_model_credentials for resp in response: ^^^^^^^^ File "/app/api/core/plugin/impl/base.py", line 211, in _request_with_plugin_daemon_response_stream self._handle_plugin_daemon_error(error.error_type, error.message) File "/app/api/core/plugin/impl/base.py", line 241, in _handle_plugin_daemon_error raise CredentialsValidateFailedError(error_object.get("message")) core.model_runtime.errors.validate.CredentialsValidateFailedError: list indices must be integers or slices, not str ``` But if I use vLLM to deploy rerank model, it can be add in dify normally. Why? What should I do to fix this error? ### ✔️ Expected Behavior Can normally add the rerank model. ### ❌ Actual Behavior _No response_
yindo closed this issue 2026-02-16 10:19:39 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Aug 6, 2025):

The error happens because Dify expects the plugin daemon to return error responses as JSON objects (dicts), but sometimes it gets a list instead, which breaks the error handler and causes the "list indices must be integers or slices, not str" message. This is both a robustness bug in Dify and a plugin-side bug with the response format [source].

To fix or work around this:

  • Double-check your rerank model configuration: make sure all required fields (provider name, model name, credentials, endpoint, and especially top_n) are set and valid. Missing or misconfigured fields (like top_n being None) are a common cause [source].
  • If you have access to the plugin daemon code or logs, ensure it always returns error responses as JSON objects, not lists.
  • If you can patch your Dify deployment, add a type check after decoding the error message in the error handler to catch and log unexpected response shapes, which will prevent this crash and give you a clearer error.
  • If possible, capture the exact payload sent to the plugin daemon and its response to help pinpoint the malformed response.
  • If you want, share your rerank model config or plugin daemon logs and I can help review them.

This issue is known and not fully resolved upstream, so these steps should help you work around it for now [source].

To reply, just mention @dosu.


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

@dosubot[bot] commented on GitHub (Aug 6, 2025): <!-- Answer --> The error happens because Dify expects the plugin daemon to return error responses as JSON objects (dicts), but sometimes it gets a list instead, which breaks the error handler and causes the "list indices must be integers or slices, not str" message. This is both a robustness bug in Dify and a plugin-side bug with the response format [[source]](https://github.com/langgenius/dify/blob/3344aaabb68d80d03f3b91320e78ef44ab603249/api/core/plugin/impl/base.py). To fix or work around this: - Double-check your rerank model configuration: make sure all required fields (provider name, model name, credentials, endpoint, and especially `top_n`) are set and valid. Missing or misconfigured fields (like `top_n` being `None`) are a common cause [[source]](https://github.com/langgenius/dify/issues/14140). - If you have access to the plugin daemon code or logs, ensure it always returns error responses as JSON objects, not lists. - If you can patch your Dify deployment, add a type check after decoding the error message in the error handler to catch and log unexpected response shapes, which will prevent this crash and give you a clearer error. - If possible, capture the exact payload sent to the plugin daemon and its response to help pinpoint the malformed response. - If you want, share your rerank model config or plugin daemon logs and I can help review them. This issue is known and not fully resolved upstream, so these steps should help you work around it for now [[source]](https://github.com/langgenius/dify/issues/20827). <!-- 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/4743193d-7bd0-47b7-b37c-39137b7498b7?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/4743193d-7bd0-47b7-b37c-39137b7498b7?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/4743193d-7bd0-47b7-b37c-39137b7498b7?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/4743193d-7bd0-47b7-b37c-39137b7498b7?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/4743193d-7bd0-47b7-b37c-39137b7498b7?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/4743193d-7bd0-47b7-b37c-39137b7498b7?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/4743193d-7bd0-47b7-b37c-39137b7498b7?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&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/23491)
Author
Owner

@Jimmy-L99 commented on GitHub (Aug 6, 2025):

@dosu I deployed Dify using Docker Compose. Is this a bug in the Dify version or is there a problem with my configuration?

@Jimmy-L99 commented on GitHub (Aug 6, 2025): @dosu I deployed `Dify `using Docker Compose. Is this a bug in the Dify version or is there a problem with my configuration?
Author
Owner

@dosubot[bot] commented on GitHub (Aug 23, 2025):

Hi, @Jimmy-L99. I'm Dosu, and I'm helping the dify-official-plugins team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You reported an error "list indices must be integers or slices, not str" when adding a rerank model in Dify v1.7.1 via Docker.
  • The error is linked to model credential saving failures and occurs because Dify expects plugin daemon error responses as JSON objects but sometimes receives lists.
  • This causes a crash due to a robustness bug in Dify and a plugin response format bug.
  • Suggested workarounds include verifying rerank model configuration (especially the top_n field), ensuring plugin daemon error responses are JSON objects, and adding type checks in Dify's error handler.
  • You asked whether this is a Dify bug or a configuration issue and sought clarification.

What's Next:

  • Please let me know if this issue is still relevant with the latest version of the dify-official-plugins repository by commenting here.
  • If I do not hear back within 5 days, I will automatically close this issue.

Thank you for your understanding and contribution!

@dosubot[bot] commented on GitHub (Aug 23, 2025): Hi, @Jimmy-L99. I'm [Dosu](https://dosu.dev), and I'm helping the dify-official-plugins team manage their backlog and am marking this issue as stale. **Issue Summary:** - You reported an error "list indices must be integers or slices, not str" when adding a rerank model in Dify v1.7.1 via Docker. - The error is linked to model credential saving failures and occurs because Dify expects plugin daemon error responses as JSON objects but sometimes receives lists. - This causes a crash due to a robustness bug in Dify and a plugin response format bug. - Suggested workarounds include verifying rerank model configuration (especially the `top_n` field), ensuring plugin daemon error responses are JSON objects, and adding type checks in Dify's error handler. - You asked whether this is a Dify bug or a configuration issue and sought clarification. **What's Next:** - Please let me know if this issue is still relevant with the latest version of the dify-official-plugins repository by commenting here. - If I do not hear back within 5 days, I will automatically close this issue. Thank you for your understanding and contribution!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-official-plugins#528