Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Response output is missing or does not contain embeddings. #10047

Closed
5 tasks done
yinzih opened this issue Oct 30, 2024 · 8 comments
Closed
5 tasks done

Error: Response output is missing or does not contain embeddings. #10047

yinzih opened this issue Oct 30, 2024 · 8 comments
Labels
👻 feat:rag Embedding related issue, like qdrant, weaviate, milvus, vector database.

Comments

@yinzih
Copy link

yinzih commented Oct 30, 2024

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

0.10.2

Cloud or Self Hosted

Cloud

Steps to reproduce

When I create a knowledge base, I get an error when embedding processing.
[tongyi] Error: Response output is missing or does not contain embeddings.
QQ20241030-095722
How can I solve this problem?

✔️ Expected Behavior

No response

❌ Actual Behavior

No response

@dosubot dosubot bot added the 👻 feat:rag Embedding related issue, like qdrant, weaviate, milvus, vector database. label Oct 30, 2024
Copy link

dosubot bot commented Oct 30, 2024

I found a similar unsolved discussion regarding the error "Response output is missing or does not contain embeddings" [1]. Additionally, there are related issues that might provide some insights:

  1. An issue titled "upload document embedding error & After deleting the failed document, the knowledge base will still retain the content of the failed document" suggests ensuring that the document size does not exceed the limit and verifying the ETL configuration. It also provides a method to manually clean up database entries if automatic deletion fails [2].

  2. Another issue, "psycopg2.errors.UndefinedTable: relation 'embedding_vector_index_0799a0c6_ca9a_418e_9e33_900236a74af4_nod' does not exist," suggests checking the Docker Compose configuration and ensuring that migrations are enabled and properly executed [3].

For your specific case, ensure that the document size is within the allowed limits and check the configuration settings related to the embedding process. If the problem persists, reviewing the logs for any additional error messages might provide more clues.

To continue talking to Dosu, mention @dosu.

@zyy13579
Copy link

zyy13579 commented Oct 30, 2024

image
I I'm running into this problem as well,on dify 0.9.1

@shisaru292
Copy link
Contributor

shisaru292 commented Oct 31, 2024

I got the same problem with the version 0.10.1. In the sentry log, it shows that the api key is invalid.

image

This issue might be related to API key encryption and storage?

image

This appears to be caused by using encrypted credentials directly as API key

@shisaru292
Copy link
Contributor

shisaru292 commented Oct 31, 2024

I got the same problem with the version 0.10.1. In the sentry log, it shows that the api key is invalid.
...
This appears to be caused by using encrypted credentials directly as API key

I reviewed the source code, and during the process of obtaining the API key, it first retrieves historical decrypted results from the Redis cache. The stored data in Redis consists of the encrypted results.

image

It seems that this piece of code did not properly modify the credentials, resulting in the direct use of the encrypted values from the database:

https://github.com/langgenius/dify/blob/0.10.1/api/core/provider_manager.py#L588-L595

@shisaru292
Copy link
Contributor

shisaru292 commented Nov 1, 2024

I obtained the encrypted credentials data and private key from Redis in the environment which has the error and simulated the decryption process locally. An exception was thrown on this line of code:

https://github.com/langgenius/dify/blob/main/api/libs/rsa.py#L76

Error message is: Incorrect decryption.

I conducted further debugging and found that the failure was caused by the invalid is 255 on this line of code:

https://github.com/langgenius/dify/blob/main/api/libs/gmpy2_pkcs10aep_cipher.py#L200

I further examined the encryption and decryption process and ultimately discovered that the error was due to the RSA public key stored in the db being inconsistent with the public key retrieved from the private key file. However, I am currently unsure why this inconsistency exists.

image

Perhaps there was an issue with updating the public key when generating the new private key.

image

@shisaru292
Copy link
Contributor

shisaru292 commented Nov 1, 2024

From the code, it appears that the public key in the db is only written once during tenant creation. If the private key for the same tenant is regenerated afterward, it will lead to an inconsistency. It seems there are no other methods in the code to update the public key.

One SOLUTION is to use the command provided by Dify to reset the key pair, but be aware that this will invalidate the existing model authentication and require reconfiguration of all providers.

https://github.com/langgenius/dify/blob/main/api/commands.py#L98-L115

In api container, flask reset-encrypt-key-pair

@shisaru292
Copy link
Contributor

I have submitted a Pull Request(#10210) for your review. Thank you! @crazywoola

Copy link

dosubot bot commented Dec 4, 2024

Hi, @yinzih. I'm Dosu, and I'm helping the Dify team manage their backlog. I'm marking this issue as stale.

Issue Summary

  • You reported an error during the embedding process in Dify version 0.10.2 on the cloud platform.
  • The error was related to missing or incomplete embeddings in the response output.
  • User shisaru292 identified a potential issue with API key encryption and proposed a solution.
  • A Pull Request (feat: add check for key matching on decryption failure #10210) was submitted to address the public key inconsistency.

Next Steps

  • Please confirm if this issue is still relevant to the latest version of Dify.
  • If the issue is resolved or no longer relevant, it will be automatically closed in 15 days unless further comments are made.

Thank you for your understanding and contribution!

@dosubot dosubot bot added the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Dec 4, 2024
@dosubot dosubot bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 19, 2024
@dosubot dosubot bot removed the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👻 feat:rag Embedding related issue, like qdrant, weaviate, milvus, vector database.
Projects
None yet
Development

No branches or pull requests

3 participants