Workflow file upload fails when filename contains special characters (e.g. test@|123.mp4) #21847

Open
opened 2026-02-21 20:14:34 -05:00 by yindo · 1 comment
Owner

Originally created by @hsiong on GitHub (Jan 22, 2026).

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • 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, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.11.4

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

  1. Go to Workflow → open any workflow that contains a file input parameter (e.g. video_file)
  2. Click Run Once
  3. Upload a file with special characters in the filename, for example:
    • test@|123.mp4
  4. Observe the upload result

✔️ Expected Behavior

  1. If the upload fails, the UI should display the actual exception / error details returned by the backend (instead of only showing a generic message).
  2. Ideally, this upload should not fail at all.
    • Dify should sanitize filenames automatically (similar to how it handles overly-long filenames by truncating them).
    • For example, automatically replace unsupported characters with underscores:
      • test@|123.mp4test__123.mp4 (or other safe normalization strategy)

Actual Behavior

Related #16867

Screenshot attached: Upload fails with a toast message: File upload failed, please upload again.

Image
Originally created by @hsiong on GitHub (Jan 22, 2026). ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [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, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.11.4 ### Cloud or Self Hosted Self Hosted (Source) ### Steps to reproduce 1. Go to **Workflow** → open any workflow that contains a **file input parameter** (e.g. `video_file`) 2. Click **Run Once** 3. Upload a file with **special characters** in the filename, for example: - `test@|123.mp4` 4. Observe the upload result ### ✔️ Expected Behavior 1. If the upload fails, the UI should display the **actual exception / error details** returned by the backend (instead of only showing a generic message). 2. Ideally, this upload **should not fail at all**. - Dify should **sanitize filenames automatically** (similar to how it handles overly-long filenames by truncating them). - For example, automatically replace unsupported characters with underscores: - `test@|123.mp4` → `test__123.mp4` (or other safe normalization strategy) ### ❌ Actual Behavior Related #16867 **Screenshot attached:** Upload fails with a toast message: `File upload failed, please upload again.` <img width="1914" height="317" alt="Image" src="https://github.com/user-attachments/assets/1270f3c2-bd9c-4bdb-9ccd-0eabe94db909" />
yindo added the 🐞 bug label 2026-02-21 20:14:34 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jan 22, 2026):

This is a confirmed bug: Dify currently rejects file uploads if the filename contains certain special characters (like |, ?, *, etc.), and the UI only shows a generic error message because the backend raises a ValueError that isn't caught or surfaced with details to the frontend. The frontend does not sanitize filenames before upload, and the backend does not attempt to auto-correct or replace unsupported characters—it simply rejects the upload if the filename contains any of these characters (source).

Currently, the only workaround is to manually rename files to remove unsupported characters before uploading. There are no merged PRs or config options that address this yet.

To improve this, the backend should either (a) sanitize filenames by replacing unsupported characters (e.g., with underscores) before saving, or (b) catch the ValueError in the upload controllers and return a clear, user-facing error message explaining which characters are not allowed. Optionally, the frontend could also pre-validate or sanitize filenames before upload to provide instant feedback.

There is an open issue tracking this, but no fix has been merged yet.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Jan 22, 2026): <!-- Answer --> This is a confirmed bug: Dify currently rejects file uploads if the filename contains certain special characters (like `|`, `?`, `*`, etc.), and the UI only shows a generic error message because the backend raises a ValueError that isn't caught or surfaced with details to the frontend. The frontend does not sanitize filenames before upload, and the backend does not attempt to auto-correct or replace unsupported characters—it simply rejects the upload if the filename contains any of these characters [(source)](https://github.com/langgenius/dify/blob/510a02286f97fde6573d310c7ac2d554c6f7923d/api/services/file_service.py#L48-L117). Currently, the only workaround is to manually rename files to remove unsupported characters before uploading. There are no merged PRs or config options that address this yet. To improve this, the backend should either (a) sanitize filenames by replacing unsupported characters (e.g., with underscores) before saving, or (b) catch the ValueError in the upload controllers and return a clear, user-facing error message explaining which characters are not allowed. Optionally, the frontend could also pre-validate or sanitize filenames before upload to provide instant feedback. There is an open issue tracking this, but no fix has been merged yet. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/b520b07b-f575-4fc8-98b2-68869ed035f1?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/b520b07b-f575-4fc8-98b2-68869ed035f1?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/b520b07b-f575-4fc8-98b2-68869ed035f1?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/b520b07b-f575-4fc8-98b2-68869ed035f1?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/b520b07b-f575-4fc8-98b2-68869ed035f1?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/b520b07b-f575-4fc8-98b2-68869ed035f1?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/b520b07b-f575-4fc8-98b2-68869ed035f1?feedback_type=other)</sup> [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=This%20is%20a%20confirmed%20bug%3A%20Dify%20currently%20rejects%20file%20uploads%20if%20the%20filename%20contains%20certain%20special%20characters%20%28like%20%60%7C%60%2C%20%60%3F%60%2C%20%60%2A%60%2C%20etc.%29%2C%20and%20the%20UI%20only%20shows%20a%20generic%20error%20message%20because%20the%20backend%20raises%20a%20ValueError%20that%20isn%27t%20caught%20or%20surfaced%20with%20details%20to%20the%20frontend.%20The%20frontend%20does%20not%20sanitize%20filenames%20before%20upload%2C%20and%20the%20backend%20does%20not%20attempt%20to%20auto-correct%20or%20replace%20unsupported%20characters%E2%80%94it%20simply%20rejects%20the%20upload%20if%20the%20filename%20contains%20any%20of%20these%20characters%20%5B%28source%29%5D%28https%3A//github.com/langgenius/dify/blob/510a02286f97fde6573d310c7ac2d554c6f7923d/api/services/file_service.py%23L48-L117%29.%0A%0ACurrently%2C%20the%20only%20workaround%20is%20to%20manually%20rename%20files%20to%20remove%20unsupported%20characters%20before%20uploading.%20There%20are%20no%20merged%20PRs%20or%20config%20options%20that%20address%20this%20yet.%0A%0ATo%20improve%20this%2C%20the%20backend%20should%20either%20%28a%29%20sanitize%20filenames%20by%20replacing%20unsupported%20characters%20%28e.g.%2C%20with%20underscores%29%20before%20saving%2C%20or%20%28b%29%20catch%20the%20ValueError%20in%20the%20upload%20controllers%20and%20return%20a%20clear%2C%20user-facing%20error%20message%20explaining%20which%20characters%20are%20not%20allowed.%20Optionally%2C%20the%20frontend%20could%20also%20pre-validate%20or%20sanitize%20filenames%20before%20upload%20to%20provide%20instant%20feedback.%0A%0AThere%20is%20an%20open%20issue%20tracking%20this%2C%20but%20no%20fix%20has%20been%20merged%20yet.)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/31411)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#21847