OpenAI-API-compatible add m3e error #335

Closed
opened 2026-02-16 10:19:02 -05:00 by yindo · 1 comment
Owner

Originally created by @yanwencheng on GitHub (Jun 4, 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

master

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

1、m3e install
docker run -d --name m3e -p 6008:6008 registry.cn-hangzhou.aliyuncs.com/fastgpt_docker/m3e-large-api
key:sk-aaabbbcccdddeeefffggghhhiiijjjkkk
test:
curl --location --request POST 'https://domain/v1/embeddings'
--header 'Authorization: Bearer xxxx'
--header 'Content-Type: application/json'
--data-raw '{
"model": "m3e",
"input": ["laf是什么"]
}'

Image

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @yanwencheng on GitHub (Jun 4, 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 master ### Cloud or Self Hosted Self Hosted (Source) ### Steps to reproduce 1、m3e install docker run -d --name m3e -p 6008:6008 registry.cn-hangzhou.aliyuncs.com/fastgpt_docker/m3e-large-api key:sk-aaabbbcccdddeeefffggghhhiiijjjkkk test: curl --location --request POST 'https://domain/v1/embeddings' \ --header 'Authorization: Bearer xxxx' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "m3e", "input": ["laf是什么"] }' ![Image](https://github.com/user-attachments/assets/dedcb80a-78ac-40d2-9d79-60d1345d5e9b) ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo closed this issue 2026-02-16 10:19:02 -05:00
Author
Owner

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

Hi @yanwencheng! I'm Dosu and I’m helping the dify team.

Your "OpenAI-API-compatible add m3e error" is related to model credential validation for a text-embedding model in Dify. Based on similar issues and the Dify codebase, here are the most likely causes and solutions:

  1. Model Name or Credential Schema Issue: The most common cause for credential validation errors is an incorrect or unsupported model name. For example, if "m3e" is not recognized by Dify or the underlying provider, you will get a validation error. Double-check that "m3e" is a valid model identifier for your provider and that it matches the expected schema. A similar issue was resolved by correcting a typo in the model name "my bad, I was used an invalid modle name".

  2. 422 Status Code: Dify itself does not typically return a 422 error. This often comes from a third-party intermediary, such as a reverse proxy or a service like Cloudflare. If you are running Dify behind such a service, try bypassing it or checking its logs for more details "A 422 error is usually not returned by Dify itself. It is typically caused by third-party intermediaries or possibly due to the use of certain serverless proxies, such as Cloudflare.".

  3. Credential Format: The credential validation process is strict. Required fields must be present, types must match, and values must be within allowed options. If any required credential is missing or misformatted, validation will fail. Review the credential schema for your provider and ensure all required fields (like api_key, endpoint_url, etc.) are filled in correctly. See the schema validation logic for details.

  4. Recent Changes: There are no recent changes in the Dify codebase that specifically affect credential validation for the "text-embedding" model type. The validation process is centralized and schema-driven, so any changes would impact all model types, not just "text-embedding".

  5. Plugin Daemon/Request Format: If you are using a third-party embedding service, Dify may send requests with a different JSON structure than expected (e.g., using documents instead of texts). If your backend expects a different format, you may need to adjust your service or use a proxy to translate the request "instead documents with texts, then you don't need any proxy".

Troubleshooting steps:

  • Verify the model name "m3e" is correct and supported by your provider.
  • Ensure all required credential fields are present and correctly formatted.
  • If using a reverse proxy or Cloudflare, try connecting directly to Dify.
  • Check your provider's logs for more detailed error messages.
  • If integrating with a custom or third-party embedding service, confirm the request/response formats match what Dify expects.

If you can share the full error traceback or the exact payload you are submitting, I can help pinpoint the issue further.

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 4, 2025): <!-- Greeting --> Hi @yanwencheng! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the dify team. <!-- Answer --> Your "OpenAI-API-compatible add m3e error" is related to model credential validation for a text-embedding model in Dify. Based on similar issues and the Dify codebase, here are the most likely causes and solutions: 1. **Model Name or Credential Schema Issue**: The most common cause for credential validation errors is an incorrect or unsupported model name. For example, if "m3e" is not recognized by Dify or the underlying provider, you will get a validation error. Double-check that "m3e" is a valid model identifier for your provider and that it matches the expected schema. A similar issue was resolved by correcting a typo in the model name ["my bad, I was used an invalid modle name"](https://github.com/langgenius/dify/issues/19800). 2. **422 Status Code**: Dify itself does not typically return a 422 error. This often comes from a third-party intermediary, such as a reverse proxy or a service like Cloudflare. If you are running Dify behind such a service, try bypassing it or checking its logs for more details ["A 422 error is usually not returned by Dify itself. It is typically caused by third-party intermediaries or possibly due to the use of certain serverless proxies, such as Cloudflare."](https://github.com/langgenius/dify/issues/16467). 3. **Credential Format**: The credential validation process is strict. Required fields must be present, types must match, and values must be within allowed options. If any required credential is missing or misformatted, validation will fail. Review the credential schema for your provider and ensure all required fields (like `api_key`, `endpoint_url`, etc.) are filled in correctly. See the [schema validation logic](https://github.com/langgenius/dify/blob/275e86a26c6b86409c391432a010fe0b1096b88e/api/core/model_runtime/schema_validators/common_validator.py) for details. 4. **Recent Changes**: There are no recent changes in the Dify codebase that specifically affect credential validation for the "text-embedding" model type. The validation process is centralized and schema-driven, so any changes would impact all model types, not just "text-embedding". 5. **Plugin Daemon/Request Format**: If you are using a third-party embedding service, Dify may send requests with a different JSON structure than expected (e.g., using `documents` instead of `texts`). If your backend expects a different format, you may need to adjust your service or use a proxy to translate the request ["instead documents with texts, then you don't need any proxy"](https://github.com/langgenius/dify/issues/16712). **Troubleshooting steps**: - Verify the model name "m3e" is correct and supported by your provider. - Ensure all required credential fields are present and correctly formatted. - If using a reverse proxy or Cloudflare, try connecting directly to Dify. - Check your provider's logs for more detailed error messages. - If integrating with a custom or third-party embedding service, confirm the request/response formats match what Dify expects. If you can share the full error traceback or the exact payload you are submitting, I can help pinpoint the issue further. <!-- 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/c73ed794-d31e-4006-9672-6a0b5286e05f?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/c73ed794-d31e-4006-9672-6a0b5286e05f?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/c73ed794-d31e-4006-9672-6a0b5286e05f?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/c73ed794-d31e-4006-9672-6a0b5286e05f?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/c73ed794-d31e-4006-9672-6a0b5286e05f?feedback_type=hallucination) | [Report ����](https://app.dosu.dev/response-feedback/c73ed794-d31e-4006-9672-6a0b5286e05f?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/c73ed794-d31e-4006-9672-6a0b5286e05f?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/20622)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-official-plugins#335