OpenAI-API-compatible Plugin add Rerank model error #20983

Closed
opened 2026-02-21 20:10:06 -05:00 by yindo · 1 comment
Owner

Originally created by @paranoiagu on GitHub (Dec 11, 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

1.11.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Add or edit Rerank model, get error:'<' not supported between instances of 'NoneType' and 'NoneType'
Image

this is log:

plugin_daemon-1 | [GIN] 2025/12/12 - 01:13:48 | 200 | 35.671714ms | 172.19.0.8 | GET "/plugin/78c3b296-605a-4a68-af3c-9add2af506b1/management/models?page=1&page_size=256"
api-1 | 2025-12-12 01:13:48.734 INFO [Dummy-667] [_client.py:1038] - HTTP Request: GET http://plugin_daemon:5002/plugin/78c3b296-605a-4a68-af3c-9add2af506b1/management/models?page=1&page_size=256 "HTTP/1.1 200 OK"
plugin_daemon-1 | [GIN] 2025/12/12 - 01:13:49 | 200 | 23.870486ms | 172.19.0.8 | POST "/plugin/78c3b296-605a-4a68-af3c-9add2af506b1/dispatch/model/validate_model_credentials"
api-1 | 2025-12-12 01:13:49.317 INFO [Dummy-667] [_client.py:1038] - HTTP Request: POST http://plugin_daemon:5002/plugin/78c3b296-605a-4a68-af3c-9add2af506b1/dispatch/model/validate_model_credentials "HTTP/1.1 200 OK"
api-1 | 2025-12-12 01:13:49.319 ERROR [Dummy-667] [base.py:277] - Error in stream response for plugin {'code': -500, 'message': '{"message":"{\"args\":{},\"error_type\":\"CredentialsValidateFailedError\",\"message\":\"'\\u003c' not supported between instances of 'NoneType' and 'NoneType'\"}","error_type":"PluginInvokeError","args":null}', 'data': None}
api-1 | 2025-12-12 01:13:49.319 ERROR [Dummy-667] [models.py:326] - Failed to save model credentials, tenant_id: 78c3b296-605a-4a68-af3c-9add2af506b1, model: test, model_type: rerank
api-1 | Traceback (most recent call last):
api-1 | File "/app/api/controllers/console/workspace/models.py", line 317, in post
api-1 | model_provider_service.create_model_credential(
api-1 | File "/app/api/services/model_provider_service.py", line 283, in create_model_credential
api-1 | provider_configuration.create_custom_model_credential(
api-1 | File "/app/api/core/entities/provider_configuration.py", line 931, in create_custom_model_credential
api-1 | credentials = self.validate_custom_model_credentials(
api-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
api-1 | File "/app/api/core/entities/provider_configuration.py", line 904, in validate_custom_model_credentials
api-1 | return _validate(session)
api-1 | ^^^^^^^^^^^^^^^^^^
api-1 | File "/app/api/core/entities/provider_configuration.py", line 893, in _validate
api-1 | validated_credentials = model_provider_factory.model_credentials_validate(
api-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
api-1 | File "/app/api/core/model_runtime/model_providers/model_provider_factory.py", line 156, 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 278, 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 308, in _handle_plugin_daemon_error
api-1 | raise CredentialsValidateFailedError(error_object.get("message"))
api-1 | core.model_runtime.errors.validate.CredentialsValidateFailedError: '<' not supported between instances of 'NoneType' and 'NoneType'
nginx-1 | 192.188.188.115 - - [12/Dec/2025:01:13:49 +0000] "POST /console/api/workspaces/current/model-providers/langgenius/openai_api_compatible/openai_api_compatible/models/credentials HTTP/1.1" 400 115 "http://192.188.188.11/plugins?action=showSettings&tab=provider" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36" "-"

✔️ Expected Behavior

success add model

Actual Behavior

No response

Originally created by @paranoiagu on GitHub (Dec 11, 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 1.11.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce Add or edit Rerank model, get error:'<' not supported between instances of 'NoneType' and 'NoneType' <img width="1741" height="1031" alt="Image" src="https://github.com/user-attachments/assets/fdf3545c-0289-4812-98bb-74983a6d059a" /> this is log: plugin_daemon-1 | [GIN] 2025/12/12 - 01:13:48 | 200 | 35.671714ms | 172.19.0.8 | GET "/plugin/78c3b296-605a-4a68-af3c-9add2af506b1/management/models?page=1&page_size=256" api-1 | 2025-12-12 01:13:48.734 INFO [Dummy-667] [_client.py:1038] - HTTP Request: GET http://plugin_daemon:5002/plugin/78c3b296-605a-4a68-af3c-9add2af506b1/management/models?page=1&page_size=256 "HTTP/1.1 200 OK" plugin_daemon-1 | [GIN] 2025/12/12 - 01:13:49 | 200 | 23.870486ms | 172.19.0.8 | POST "/plugin/78c3b296-605a-4a68-af3c-9add2af506b1/dispatch/model/validate_model_credentials" api-1 | 2025-12-12 01:13:49.317 INFO [Dummy-667] [_client.py:1038] - HTTP Request: POST http://plugin_daemon:5002/plugin/78c3b296-605a-4a68-af3c-9add2af506b1/dispatch/model/validate_model_credentials "HTTP/1.1 200 OK" api-1 | 2025-12-12 01:13:49.319 ERROR [Dummy-667] [base.py:277] - Error in stream response for plugin {'code': -500, 'message': '{"message":"{\\"args\\":{},\\"error_type\\":\\"CredentialsValidateFailedError\\",\\"message\\":\\"\'\\\\u003c\' not supported between instances of \'NoneType\' and \'NoneType\'\\"}","error_type":"PluginInvokeError","args":null}', 'data': None} api-1 | 2025-12-12 01:13:49.319 ERROR [Dummy-667] [models.py:326] - Failed to save model credentials, tenant_id: 78c3b296-605a-4a68-af3c-9add2af506b1, model: test, model_type: rerank api-1 | Traceback (most recent call last): api-1 | File "/app/api/controllers/console/workspace/models.py", line 317, in post api-1 | model_provider_service.create_model_credential( api-1 | File "/app/api/services/model_provider_service.py", line 283, in create_model_credential api-1 | provider_configuration.create_custom_model_credential( api-1 | File "/app/api/core/entities/provider_configuration.py", line 931, in create_custom_model_credential api-1 | credentials = self.validate_custom_model_credentials( api-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ api-1 | File "/app/api/core/entities/provider_configuration.py", line 904, in validate_custom_model_credentials api-1 | return _validate(session) api-1 | ^^^^^^^^^^^^^^^^^^ api-1 | File "/app/api/core/entities/provider_configuration.py", line 893, in _validate api-1 | validated_credentials = model_provider_factory.model_credentials_validate( api-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ api-1 | File "/app/api/core/model_runtime/model_providers/model_provider_factory.py", line 156, 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 278, 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 308, in _handle_plugin_daemon_error api-1 | raise CredentialsValidateFailedError(error_object.get("message")) api-1 | core.model_runtime.errors.validate.CredentialsValidateFailedError: '<' not supported between instances of 'NoneType' and 'NoneType' nginx-1 | 192.188.188.115 - - [12/Dec/2025:01:13:49 +0000] "POST /console/api/workspaces/current/model-providers/langgenius/openai_api_compatible/openai_api_compatible/models/credentials HTTP/1.1" 400 115 "http://192.188.188.11/plugins?action=showSettings&tab=provider" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36" "-" ### ✔️ Expected Behavior success add model ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug label 2026-02-21 20:10:06 -05:00
yindo closed this issue 2026-02-21 20:10:06 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Dec 11, 2025):

This error is a known issue when adding or editing Rerank models with the OpenAI-API-compatible plugin. The root cause is almost always a missing or None value for a required field in the model configuration—most commonly the top_n parameter, but sometimes also context_size or other required fields. When these are not set, the plugin or Dify core tries to compare or iterate over None, resulting in the '<' not supported between instances of 'NoneType' and 'NoneType' error during credential validation. This can also happen if the plugin returns malformed responses or if the credential validation endpoint doesn't return the expected JSON schema with a boolean result field (source, source, source).

How to fix/work around:

  1. Double-check your rerank model configuration. Make sure all required fields are set and not None:

    • top_n (set to a valid integer, e.g., 3)
    • context_size (set to a valid integer, e.g., 4096)
    • api_key, endpoint_url, and any other required credential fields for your provider
  2. If the UI does not show all required fields (like context_size), try switching the model type to LLM, set the missing field, then switch back to Rerank and save. Alternatively, use the API or a direct PATCH request to set the missing field (source).

  3. Ensure your plugin's credential validation endpoint returns a JSON object with a boolean result field (not results or data). If you control the plugin, update its response format accordingly (source).

  4. If your rerank plugin returns documents with a score field set to None (for example, when relevance_score is null), filter out those documents or ensure every document has a valid float score (source).

  5. If you are running in Docker, make sure your endpoint URLs are accessible from inside the container (use host.docker.internal instead of localhost if needed).

  6. After making changes, restart the Dify and plugin_daemon containers to clear any cached state.

If you follow these steps and ensure all required fields are set and valid, the error should be resolved. If you still see the error, capturing the exact payload sent to the plugin daemon and its response can help pinpoint any malformed data causing the issue (source).

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 (Dec 11, 2025): <!-- Answer --> This error is a known issue when adding or editing Rerank models with the OpenAI-API-compatible plugin. The root cause is almost always a missing or None value for a required field in the model configuration—most commonly the `top_n` parameter, but sometimes also `context_size` or other required fields. When these are not set, the plugin or Dify core tries to compare or iterate over None, resulting in the `'<' not supported between instances of 'NoneType' and 'NoneType'` error during credential validation. This can also happen if the plugin returns malformed responses or if the credential validation endpoint doesn't return the expected JSON schema with a boolean `result` field ([source](https://github.com/langgenius/dify/issues/20827), [source](https://github.com/langgenius/dify/issues/14140), [source](https://github.com/langgenius/dify/discussions/23573)). **How to fix/work around:** 1. Double-check your rerank model configuration. Make sure all required fields are set and not None: - `top_n` (set to a valid integer, e.g., 3) - `context_size` (set to a valid integer, e.g., 4096) - `api_key`, `endpoint_url`, and any other required credential fields for your provider 2. If the UI does not show all required fields (like `context_size`), try switching the model type to LLM, set the missing field, then switch back to Rerank and save. Alternatively, use the API or a direct PATCH request to set the missing field ([source](https://github.com/langgenius/dify/issues/27765)). 3. Ensure your plugin's credential validation endpoint returns a JSON object with a boolean `result` field (not `results` or `data`). If you control the plugin, update its response format accordingly ([source](https://github.com/langgenius/dify/discussions/23573)). 4. If your rerank plugin returns documents with a `score` field set to `None` (for example, when `relevance_score` is null), filter out those documents or ensure every document has a valid float `score` ([source](https://github.com/langgenius/dify/issues/24992)). 5. If you are running in Docker, make sure your endpoint URLs are accessible from inside the container (use `host.docker.internal` instead of `localhost` if needed). 6. After making changes, restart the Dify and plugin_daemon containers to clear any cached state. If you follow these steps and ensure all required fields are set and valid, the error should be resolved. If you still see the error, capturing the exact payload sent to the plugin daemon and its response can help pinpoint any malformed data causing the issue ([source](https://github.com/langgenius/dify/issues/23491)). <!-- 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/d6047de3-954f-4c1b-81a6-b393ff14df99?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/d6047de3-954f-4c1b-81a6-b393ff14df99?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/d6047de3-954f-4c1b-81a6-b393ff14df99?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/d6047de3-954f-4c1b-81a6-b393ff14df99?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/d6047de3-954f-4c1b-81a6-b393ff14df99?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/d6047de3-954f-4c1b-81a6-b393ff14df99?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/d6047de3-954f-4c1b-81a6-b393ff14df99?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=This%20error%20is%20a%20known%20issue%20when%20adding%20or%20editing%20Rerank%20models%20with%20the%20OpenAI-API-compatible%20plugin.%20The%20root%20cause%20is%20almost%20always%20a%20missing%20or%20None%20value%20for%20a%20required%20field%20in%20the%20model%20configuration%E2%80%94most%20commonly%20the%20%60top_n%60%20parameter%2C%20but%20sometimes%20also%20%60context_size%60%20or%20other%20required%20fields.%20When%20these%20are%20not%20set%2C%20the%20plugin%20or%20Dify%20core%20tries%20to%20compare%20or%20iterate%20over%20None%2C%20resulting%20in%20the%20%60%27%3C%27%20not%20supported%20between%20instances%20of%20%27NoneType%27%20and%20%27NoneType%27%60%20error%20during%20credential%20validation.%20This%20can%20also%20happen%20if%20the%20plugin%20returns%20malformed%20responses%20or%20if%20the%20credential%20validation%20endpoint%20doesn%27t%20return%20the%20expected%20JSON%20schema%20with%20a%20boolean%20%60result%60%20field%C2%A0%28%5Bsource%5D%28https%3A//github.com/langgenius/dify/issues/20827%29%2C%20%5Bsource%5D%28https%3A//github.com/langgenius/dify/issues/14140%29%2C%20%5Bsource%5D%28https%3A//github.com/langgenius/dify/discussions/23573%29%29.%0A%0A%2A%2AHow%20to%20fix/work%20around%3A%2A%2A%0A%0A1.%20Double-check%20your%20rerank%20model%20configuration.%20Make%20sure%20all%20required%20fields%20are%20set%20and%20not%20None%3A%20%20%0A%20%20%20-%20%60top_n%60%20%28set%20to%20a%20valid%20integer%2C%20e.g.%2C%203%29%0A%20%20%20-%20%60context_size%60%20%28set%20to%20a%20valid%20integer%2C%20e.g.%2C%204096%29%0A%20%20%20-%20%60api_key%60%2C%20%60endpoint_url%60%2C%20and%20any%20other%20required%20credential%20fields%20for%20your%20provider%0A%0A2.%20If%20the%20UI%20does%20not%20show%20all%20required%20fields%20%28like%20%60context_size%60%29%2C%20try%20switching%20the%20model%20type%20to%20LLM%2C%20set%20the%20missing%20field%2C%20then%20switch%20back%20to%20Rerank%20and%20save.%20Alternatively%2C%20use%20the%20API%20or%20a%20direct%20PATCH%20request%20to%20set%20the%20missing%20field%20%28%5Bsource%5D%28https%3A//github.com/langgenius/dify/issues/27765%29%29.%0A%0A3.%20Ensure%20your%20plugin%27s%20credential%20validation%20endpoint%20returns%20a%20JSON%20object%20with%20a%20boolean%20%60result%60%20field%20%28not%20%60results%60%20or%20%60data%60%29.%20If%20you%20control%20the%20plugin%2C%20update%20its%20response%20format%20accordingly%20%28%5Bsource%5D%28https%3A//github.com/langgenius/dify/discussions/23573%29%29.%0A%0A4.%20If%20your%20rerank%20plugin%20returns%20documents%20with%20a%20%60score%60%20field%20set%20to%20%60None%60%20%28for%20example%2C%20when%20%60relevance_score%60%20is%20null%29%2C%20filter%20out%20those%20documents%20or%20ensure%20every%20document%20has%20a%20valid%20float%20%60score%60%20%28%5Bsource%5D%28https%3A//github.com/langgenius/dify/issues/24992%29%29.%0A%0A5.%20If%20you%20are%20running%20in%20Docker%2C%20make%20sure%20your%20endpoint%20URLs%20are%20accessible%20from%20inside%20the%20container%20%28use%20%60host.docker.internal%60%20instead%20of%20%60localhost%60%20if%20needed%29.%0A%0A6.%20After%20making%20changes%2C%20restart%20the%20Dify%20and%20plugin_daemon%20containers%20to%20clear%20any%20cached%20state.%0A%0AIf%20you%20follow%20these%20steps%20and%20ensure%20all%20required%20fields%20are%20set%20and%20valid%2C%20the%20error%20should%20be%20resolved.%20If%20you%20still%20see%20the%20error%2C%20capturing%20the%20exact%20payload%20sent%20to%20the%20plugin%20daemon%20and%20its%20response%20can%20help%20pinpoint%20any%20malformed%20data%20causing%20the%20issue%20%28%5Bsource%5D%28https%3A//github.com/langgenius/dify/issues/23491%29%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/29530)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#20983