When uploading files through the api interface(create_by_file), there will be a success and a failure? #5428

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

Originally created by @PsycheJ on GitHub (Sep 6, 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.7.3

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

调用create_by_file接口时,存在一次成功,一次失败的结果;失败的情况下接口返回File not found
image
image

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @PsycheJ on GitHub (Sep 6, 2024). ### 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 0.7.3 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce 调用create_by_file接口时,存在一次成功,一次失败的结果;失败的情况下接口返回File not found ![image](https://github.com/user-attachments/assets/369a1d5c-9aa6-47ac-bf78-ae8565faae52) ![image](https://github.com/user-attachments/assets/4620dbb0-3557-47c0-abb9-a725b7e76c2b) ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug label 2026-02-21 18:10:55 -05:00
yindo closed this issue 2026-02-21 18:10:56 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Sep 6, 2024):

I found some similar discussions that might be relevant to your issue:

  1. I can't upload the image on dify workflow via api (open) [1].
  2. Where are the images and files generated by Dify stored? Also, the tool's API cannot access the generated files. (open) [2].
  3. 知识库上传文件报错 (open) [3].

Regarding your specific issue, yes, it is possible to have both a success and a failure when uploading files through the create_by_file API interface. The error "File not found" indicates that the specified file could not be located or accessed during the upload process. This error might also occur if there are issues with the deployment method or if the api/storage/privkeys directory has been deleted, as this file is used to encrypt large model keys [4][5].

To resolve the "File not found" error in a local deployment, you can reset the encryption key pair using the following commands:

  • Docker Compose Deployment:

    docker exec -it docker-api-1 flask reset-encrypt-key-pair
    
  • Source Code Deployment:
    Navigate to the api directory and run:

    flask reset-encrypt-key-pair
    

Follow the prompts to complete the reset process [4][5].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Sep 6, 2024): <!-- Answer --> I found some similar discussions that might be relevant to your issue: 1. [I can't upload the image on dify workflow via api](https://github.com/langgenius/dify/discussions/7482) (open) <sup>[[1]](https://github.com/langgenius/dify/discussions/7482)</sup>. 2. [Where are the images and files generated by Dify stored? Also, the tool's API cannot access the generated files.](https://github.com/langgenius/dify/discussions/7380) (open) <sup>[[2]](https://github.com/langgenius/dify/discussions/7380)</sup>. 3. [知识库上传文件报错](https://github.com/langgenius/dify/discussions/3394) (open) <sup>[[3]](https://github.com/langgenius/dify/discussions/3394)</sup>. Regarding your specific issue, yes, it is possible to have both a success and a failure when uploading files through the `create_by_file` API interface. The error "File not found" indicates that the specified file could not be located or accessed during the upload process. This error might also occur if there are issues with the deployment method or if the `api/storage/privkeys` directory has been deleted, as this file is used to encrypt large model keys <sup>[[4]](https://github.com/langgenius/dify-docs/blob/main/jp/guides/knowledge-base/maintain-dataset-via-api.md)</sup><sup>[[5]](https://github.com/langgenius/dify-docs/blob/main/jp/features/datasets/maintain-dataset-via-api.md)</sup>. To resolve the "File not found" error in a local deployment, you can reset the encryption key pair using the following commands: - **Docker Compose Deployment**: ```bash docker exec -it docker-api-1 flask reset-encrypt-key-pair ``` - **Source Code Deployment**: Navigate to the `api` directory and run: ```bash flask reset-encrypt-key-pair ``` Follow the prompts to complete the reset process <sup>[[4]](https://github.com/langgenius/dify-docs/blob/main/jp/guides/knowledge-base/maintain-dataset-via-api.md)</sup><sup>[[5]](https://github.com/langgenius/dify-docs/blob/main/jp/features/datasets/maintain-dataset-via-api.md)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#5428