Got validation failed error for custom file extension in Chatflow #7952

Closed
opened 2026-02-21 18:23:12 -05:00 by yindo · 8 comments
Owner

Originally created by @tjroamer on GitHub (Feb 2, 2025).

Originally assigned to: @laipz8200 on GitHub.

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.15.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

  • In a Chatflow, click "Features->File Upload->Settings->Other file types"
  • Enter file extension, e.g. .py, click the Save button
  • Click "Preview", and upload a python file e.g. test.py
  • Type any message and click send, I got "File validation failed for file: test.py" error popup message

Tested other extensions as well, and got the same error.

Image

✔️ Expected Behavior

No error, the custom file type should be recognized

Actual Behavior

Image

Originally created by @tjroamer on GitHub (Feb 2, 2025). Originally assigned to: @laipz8200 on GitHub. ### 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.15.2 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce - In a Chatflow, click "Features->File Upload->Settings->Other file types" - Enter file extension, e.g. .py, click the Save button - Click "Preview", and upload a python file e.g. test.py - Type any message and click send, I got "File validation failed for file: test.py" error popup message Tested other extensions as well, and got the same error. ![Image](https://github.com/user-attachments/assets/78555682-bed3-4354-b8f0-609050c6fd21) ### ✔️ Expected Behavior No error, the custom file type should be recognized ### ❌ Actual Behavior ![Image](https://github.com/user-attachments/assets/cba5d432-8908-42f0-a20e-96dd880f9235)
yindo added the 🐞 bug label 2026-02-21 18:23:12 -05:00
yindo closed this issue 2026-02-21 18:23:12 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Feb 2, 2025):

Hey @tjroamer! I'm here to help you with any bugs, questions, or contributions you have for Dify. Let's tackle this issue together!

I found a similar open issue regarding the "File validation failed" error for custom file extensions in Chatflow. The suggested solution involves ensuring that the file type is specified as 'custom' in the input parameters when using the Workflow API's /workflows/run endpoint. Here's an example configuration:

{
  'inputs': {
    'doc': {
      'type': 'custom',
      'transfer_method': 'remote_url',
      'url': 'your-file-url'
    }
  }
}

Additionally, make sure that your FileUploadConfig allows for custom file types and that the file extension is included in the allowed_file_extensions if specified. The validation process checks if the file type is either in the allowed types or is 'custom', and if the extension is permitted [1].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@dosubot[bot] commented on GitHub (Feb 2, 2025): <!-- Greeting --> Hey @tjroamer! I'm here to help you with any bugs, questions, or contributions you have for Dify. Let's tackle this issue together! <!-- Answer --> I found a similar open issue regarding the "File validation failed" error for custom file extensions in Chatflow. The suggested solution involves ensuring that the file type is specified as 'custom' in the input parameters when using the Workflow API's /workflows/run endpoint. Here's an example configuration: ```json { 'inputs': { 'doc': { 'type': 'custom', 'transfer_method': 'remote_url', 'url': 'your-file-url' } } } ``` Additionally, make sure that your `FileUploadConfig` allows for custom file types and that the file extension is included in the `allowed_file_extensions` if specified. The validation process checks if the file type is either in the allowed types or is 'custom', and if the extension is permitted <sup>[[1]](https://github.com/langgenius/dify/issues/11671)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/c7cbd370-3ccb-4d34-a848-ffaa1bc9b677?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/c7cbd370-3ccb-4d34-a848-ffaa1bc9b677?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/c7cbd370-3ccb-4d34-a848-ffaa1bc9b677?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/c7cbd370-3ccb-4d34-a848-ffaa1bc9b677?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/c7cbd370-3ccb-4d34-a848-ffaa1bc9b677?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/c7cbd370-3ccb-4d34-a848-ffaa1bc9b677?feedback_type=other)</sup>
Author
Owner

@laipz8200 commented on GitHub (Feb 2, 2025):

Hi @tjroamer, thank you for your report. Could you share a minimum DSL with us? I'd like to know which model you used and how the file variable was inserted into the prompt.

@laipz8200 commented on GitHub (Feb 2, 2025): Hi @tjroamer, thank you for your report. Could you share a minimum DSL with us? I'd like to know which model you used and how the file variable was inserted into the prompt.
Author
Owner

@tjroamer commented on GitHub (Feb 3, 2025):

Please see the exported DSL, which is really nothing special. I appended a json extension to the file to make it a supported format by github.

Test Chatflow.yml.json

@tjroamer commented on GitHub (Feb 3, 2025): Please see the exported DSL, which is really nothing special. I appended a json extension to the file to make it a supported format by github. [Test Chatflow.yml.json](https://github.com/user-attachments/files/18647949/Test.Chatflow.yml.json)
Author
Owner

@laipz8200 commented on GitHub (Feb 7, 2025):

Hi @tjroamer. The DSL file you provided uses an undefined variable body in the LLM node, so I cannot reproduce this issue, could you check again?

@laipz8200 commented on GitHub (Feb 7, 2025): Hi @tjroamer. The DSL file you provided uses an undefined variable `body` in the LLM node, so I cannot reproduce this issue, could you check again?
Author
Owner

@tjroamer commented on GitHub (Feb 14, 2025):

Yes, you are right. I have no clue where the body was coming from. I removed it and uploaded again. In fact, there is really no magic with this project. You can use any Chatflow to test. If you select "Features->File Upload->Settings->Other file types" and then select your own file extension and Save. You will be able to see the error when you upload a file and post a message.

Test Chatflow 2.yml.json

@tjroamer commented on GitHub (Feb 14, 2025): Yes, you are right. I have no clue where the body was coming from. I removed it and uploaded again. In fact, there is really no magic with this project. You can use any Chatflow to test. If you select "Features->File Upload->Settings->Other file types" and then select your own file extension and Save. You will be able to see the error when you upload a file and post a message. [Test Chatflow 2.yml.json](https://github.com/user-attachments/files/18805087/Test.Chatflow.2.yml.json)
Author
Owner

@tjroamer commented on GitHub (Mar 3, 2025):

I tested the version 1.0.0, found the problem is still there: I'm not able to upload files with custom extensions. It would be good if this bug can be fixed. I'd like to let the chatbot users upload a project file and do some processing in code block, but due to this bug, we can't realize it. Thanks.

@tjroamer commented on GitHub (Mar 3, 2025): I tested the version 1.0.0, found the problem is still there: I'm not able to upload files with custom extensions. It would be good if this bug can be fixed. I'd like to let the chatbot users upload a project file and do some processing in code block, but due to this bug, we can't realize it. Thanks.
Author
Owner

@laipz8200 commented on GitHub (Mar 13, 2025):

@tjroamer Hi there!
I tried to fix this issue. Would you like to test it in #15714?

@laipz8200 commented on GitHub (Mar 13, 2025): @tjroamer Hi there! I tried to fix this issue. Would you like to test it in #15714?
Author
Owner

@tjroamer commented on GitHub (Mar 19, 2025):

Yes, it works well with the version 1.1.0. Many thanks for the fix! @laipz8200

@tjroamer commented on GitHub (Mar 19, 2025): Yes, it works well with the version 1.1.0. Many thanks for the fix! @laipz8200
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#7952