Out of range float values are not JSON compliant: nan
Closed this issue · 2 comments
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.13.2
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
I encountered this error while uploading the document to the knowledge base:Out of range float values are not JSON compliant: nan
✔️ Expected Behavior
No response
❌ Actual Behavior
No response
@luoyutao03 你好!我是Dosu,一个可以帮助你解决 bug、回答问题,并成为贡献者的机器人。我会在等待人类维护者的期间帮助你。
The error message "Out of range float values are not JSON compliant: nan" typically occurs when a JSON serialization process encounters a NaN
(Not a Number) value, which is not supported by the JSON standard. This issue can arise during the document processing or indexing phase in Dify.
To address this issue, you can try the following steps:
-
Check Document Content: Ensure that the document does not contain any invalid numerical values that could be interpreted as
NaN
. This might involve reviewing the document for any unusual data entries or calculations. -
Review Code for JSON Serialization: If you have access to the codebase, look for any parts of the code where float values are processed or converted to JSON. Ensure that these values are validated or converted to a JSON-compliant format before serialization.
-
Error Handling: Implement error handling to catch and manage
NaN
values before they are serialized. This can involve setting default values or skipping problematic entries. -
Update Dependencies: Ensure that all dependencies and libraries used for JSON processing are up to date, as newer versions might handle such cases more gracefully.
If the issue persists, you might need to delve deeper into the specific part of the codebase where JSON serialization occurs, although the exact location of this logic in the Dify codebase is not specified in the available information.
To continue talking to Dosu, mention @dosu.
Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other
Can you provide the container logs of the api and worker.