mirror of
https://github.com/langgenius/dify-official-plugins.git
synced 2026-07-21 17:45:23 -04:00
Failed to add rerank model by openai-api-compatible plugin, return "400 Error" #747
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @plutonji on GitHub (Oct 23, 2025).
Self Checks
Dify version
1.8.1
Plugin version
0.0.22
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
It failed with a "400 client error"
✔️ Error log
We get the network package sent to validate the server.
It shows top_n = 3 while there were only two documents so the server failed.
Check the code here:
https://github.com/langgenius/dify-official-plugins/blob/main/models/openai_api_compatible/models/rerank/rerank.py
We can see there are only two strings from line 24 to 27 because there is no comma at line 24 and 26!
@dosubot[bot] commented on GitHub (Oct 23, 2025):
Hi @plutonji! I'm Dosu and I’m helping the dify-official-plugins team.
The 400 error happens because in rerank.py, the docs list is missing commas between string entries, so Python treats them as a single string instead of two separate documents. This leads to a mismatch: top_n is set to 3, but only one (concatenated) document is sent, causing the server to reject the request since top_n must not exceed the number of documents.
To fix this, add commas between the document strings in the docs list so each document is a separate list item. This will ensure the payload matches the expected format and prevent the 400 error. You can see the relevant code and explanation here.
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other
