dify icon indicating copy to clipboard operation
dify copied to clipboard

Uploaded file shows: File not found

Open kokojacket opened this issue 1 year ago • 1 comments

Self Checks

  • [X] This is only for bug report, if you would like to ask a question, please head to Discussions.
  • [X] I have searched for existing issues search for existing issues, including closed ones.
  • [X] I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [X] Please do not modify this template :) and fill in all the required fields.

Dify version

0.6.8

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

I am preparing to build a knowledge base and uploaded a txt file, about 2KB. In the last step, File not found__ was displayed. image 日志: [2024-05-20 09:27:34,271: ERROR/MainProcess] consume document failed 2024-05-20 17:27:34 Traceback (most recent call last): 2024-05-20 17:27:34 File "/app/api/core/indexing_runner.py", line 64, in run 2024-05-20 17:27:34 text_docs = self._extract(index_processor, dataset_document, processing_rule.to_dict()) 2024-05-20 17:27:34 File "/app/api/core/indexing_runner.py", line 362, in _extract 2024-05-20 17:27:34 text_docs = index_processor.extract(extract_setting, process_rule_mode=process_rule['mode']) 2024-05-20 17:27:34 File "/app/api/core/rag/index_processor/processor/paragraph_index_processor.py", line 21, in extract 2024-05-20 17:27:34 text_docs = ExtractProcessor.extract(extract_setting=extract_setting, 2024-05-20 17:27:34 File "/app/api/core/rag/extractor/extract_processor.py", line 81, in extract 2024-05-20 17:27:34 storage.download(upload_file.key, file_path) 2024-05-20 17:27:34 File "/app/api/extensions/ext_storage.py", line 54, in download 2024-05-20 17:27:34 self.storage_runner.download(filename, target_filepath) 2024-05-20 17:27:34 File "/app/api/extensions/storage/local_storage.py", line 70, in download 2024-05-20 17:27:34 raise FileNotFoundError("File not found") 2024-05-20 17:27:34 FileNotFoundError: File not found

✔️ Expected Behavior

No response

❌ Actual Behavior

No response

kokojacket avatar May 20 '24 09:05 kokojacket

The FileNotFoundError you're encountering during the file upload process in your self-hosted Dify setup is due to the application's inability to locate the uploaded file for extraction. This issue typically arises from a problem with the storage configuration or file access permissions. Here are the steps to troubleshoot and potentially resolve the issue:

  1. Check Host Directory and Permissions: Ensure the host directory (./volumes/app/storage) exists and that the Docker container has the correct permissions to access this directory. This is crucial for the application to read from and write to the storage.

  2. Review Docker Compose Configuration: Verify that your Docker Compose file correctly configures the volume mount. Any misconfiguration or typo could lead to the application not being able to access the intended storage directory.

  3. Reset Encryption Keys: If there's a possibility that the api/storage/privkeys file is missing or corrupted (which might happen if deployment methods were switched or the file was deleted), you can reset the encryption keys using the command: docker exec -it docker-api-1 flask reset-encrypt-key-pair. This step is relevant for Docker Compose deployments and is necessary for the encryption of large model keys.

By following these steps, you should be able to identify and correct the issue causing the FileNotFoundError. If the problem persists, providing additional details about your configuration and any changes made prior to encountering this error could help in further diagnosing the issue.

Details

Sources


About Dosu This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

dosubot[bot] avatar May 20 '24 09:05 dosubot[bot]

seems your api service and worker service have different storage setting , pls check the variable STORAGE_TYPE @kokojacket

JohnJyong avatar May 21 '24 09:05 JohnJyong

Thank you very much, it is indeed my deployment that has a problem. __

kokojacket avatar May 21 '24 09:05 kokojacket

hi I got the same error, but I checked both api and worker has image image

STORAGE_TYPE configured as * log at worker container image

I can see a file at api container though image

tried again with a txt file image the content is correct log at worker container image

seeyou112d avatar Sep 19 '24 10:09 seeyou112d