Can not upload files #20764

Closed
opened 2026-02-21 20:08:52 -05:00 by yindo · 8 comments
Owner

Originally created by @RoboSimonLee on GitHub (Dec 3, 2025).

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

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

I tested it in both the web app and Postman, but I was unable to upload files. The error message is shown in the image.

Image Image

✔️ Expected Behavior

Upload files correctly

Actual Behavior

Error when uploading local files

Originally created by @RoboSimonLee on GitHub (Dec 3, 2025). ### 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.10.1 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce I tested it in both the web app and Postman, but I was unable to upload files. The error message is shown in the image. <img width="554" height="195" alt="Image" src="https://github.com/user-attachments/assets/8f6e4782-6ce2-4501-9330-8a7b4dd9d1e3" /> <img width="554" height="476" alt="Image" src="https://github.com/user-attachments/assets/efb2b425-b41d-47be-8926-280f4fe6f8c5" /> ### ✔️ Expected Behavior Upload files correctly ### ❌ Actual Behavior Error when uploading local files
yindo added the 🐞 bug label 2026-02-21 20:08:52 -05:00
yindo closed this issue 2026-02-21 20:08:52 -05:00
Author
Owner

@crazywoola commented on GitHub (Dec 3, 2025):

For internal server errors please provide logs from the container instead.

@crazywoola commented on GitHub (Dec 3, 2025): For internal server errors please provide logs from the container instead.
Author
Owner

@dosubot[bot] commented on GitHub (Dec 3, 2025):

The most common causes of file upload failures and 500 errors in self-hosted Dify Docker setups are misconfiguration of environment variables and Docker networking. Here’s a checklist to resolve this:

  1. In your .env file, set FILES_URL to http://api:5001 (for Docker Compose) or to http://<your-host-ip>:5001 if running outside Compose. If you have INTERNAL_FILES_URL, set it to http://api:5001 as well. This ensures internal services and plugins can access uploaded files correctly [details][more][even more].

  2. Make sure port 5001 is exposed in your docker-compose.yaml for the API service:

    ports:
      - "5001:5001"
    

    Without this, file uploads and plugin access will fail [source].

  3. Check that your storage directory (default: storage) is correctly mounted and writable by the container. If using the default local storage, verify OPENDAL_FS_ROOT=storage and that the directory exists and has proper permissions [reference].

  4. Review your upload file size limits (UPLOAD_FILE_SIZE_LIMIT, NGINX_CLIENT_MAX_BODY_SIZE) and file extension blacklist (UPLOAD_FILE_EXTENSION_BLACKLIST) in your .env file. Blocked extensions or oversized files will cause errors [reference].

  5. After making changes, restart your Docker containers for the new settings to take effect.

If uploads still fail, check the API and plugin container logs for detailed error messages or stack traces. This will help pinpoint whether the issue is with storage, permissions, or configuration [reference].

Let me know if you need help interpreting any log output or if you have more details from the server logs!

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 (Dec 3, 2025): <!-- Answer --> The most common causes of file upload failures and 500 errors in self-hosted Dify Docker setups are misconfiguration of environment variables and Docker networking. Here’s a checklist to resolve this: 1. In your `.env` file, set `FILES_URL` to `http://api:5001` (for Docker Compose) or to `http://<your-host-ip>:5001` if running outside Compose. If you have `INTERNAL_FILES_URL`, set it to `http://api:5001` as well. This ensures internal services and plugins can access uploaded files correctly [[details](https://github.com/langgenius/dify-official-plugins/issues/1816)][[more](https://github.com/langgenius/dify-official-plugins/issues/2110)][[even more](https://github.com/langgenius/dify-official-plugins/issues/1815)]. 2. Make sure port 5001 is exposed in your `docker-compose.yaml` for the API service: ``` ports: - "5001:5001" ``` Without this, file uploads and plugin access will fail [[source](https://github.com/langgenius/dify-official-plugins/issues/1816)]. 3. Check that your storage directory (default: `storage`) is correctly mounted and writable by the container. If using the default local storage, verify `OPENDAL_FS_ROOT=storage` and that the directory exists and has proper permissions [[reference](https://github.com/langgenius/dify/blob/876f48df761d3a8e92b0d794942c16ff73e982d0/docker/.env.example#L44-L1218)]. 4. Review your upload file size limits (`UPLOAD_FILE_SIZE_LIMIT`, `NGINX_CLIENT_MAX_BODY_SIZE`) and file extension blacklist (`UPLOAD_FILE_EXTENSION_BLACKLIST`) in your `.env` file. Blocked extensions or oversized files will cause errors [[reference](https://github.com/langgenius/dify/pull/27540)]. 5. After making changes, restart your Docker containers for the new settings to take effect. If uploads still fail, check the API and plugin container logs for detailed error messages or stack traces. This will help pinpoint whether the issue is with storage, permissions, or configuration [[reference](https://github.com/langgenius/dify-official-plugins/issues/2110)]. Let me know if you need help interpreting any log output or if you have more details from the server logs! <!-- 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/77443987-7476-40b2-be23-9576fee4e7f4?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/77443987-7476-40b2-be23-9576fee4e7f4?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/77443987-7476-40b2-be23-9576fee4e7f4?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/77443987-7476-40b2-be23-9576fee4e7f4?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/77443987-7476-40b2-be23-9576fee4e7f4?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/77443987-7476-40b2-be23-9576fee4e7f4?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/77443987-7476-40b2-be23-9576fee4e7f4?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=The%20most%20common%20causes%20of%20file%20upload%20failures%20and%20500%20errors%20in%20self-hosted%20Dify%20Docker%20setups%20are%20misconfiguration%20of%20environment%20variables%20and%20Docker%20networking.%20Here%E2%80%99s%20a%20checklist%20to%20resolve%20this%3A%0A%0A1.%20In%20your%20%60.env%60%20file%2C%20set%20%60FILES_URL%60%20to%20%60http%3A//api%3A5001%60%20%28for%20Docker%20Compose%29%20or%20to%20%60http%3A//%3Cyour-host-ip%3E%3A5001%60%20if%20running%20outside%20Compose.%20If%20you%20have%20%60INTERNAL_FILES_URL%60%2C%20set%20it%20to%20%60http%3A//api%3A5001%60%20as%20well.%20This%20ensures%20internal%20services%20and%20plugins%20can%20access%20uploaded%20files%20correctly%20%5B%5Bdetails%5D%28https%3A//github.com/langgenius/dify-official-plugins/issues/1816%29%5D%5B%5Bmore%5D%28https%3A//github.com/langgenius/dify-official-plugins/issues/2110%29%5D%5B%5Beven%20more%5D%28https%3A//github.com/langgenius/dify-official-plugins/issues/1815%29%5D.%0A%0A2.%20Make%20sure%20port%205001%20is%20exposed%20in%20your%20%60docker-compose.yaml%60%20for%20the%20API%20service%3A%0A%20%20%20%60%60%60%0A%20%20%20ports%3A%0A%20%20%20%20%20-%20%225001%3A5001%22%0A%20%20%20%60%60%60%0A%20%20%20Without%20this%2C%20file%20uploads%20and%20plugin%20access%20will%20fail%20%5B%5Bsource%5D%28https%3A//github.com/langgenius/dify-official-plugins/issues/1816%29%5D.%0A%0A3.%20Check%20that%20your%20storage%20directory%20%28default%3A%20%60storage%60%29%20is%20correctly%20mounted%20and%20writable%20by%20the%20container.%20If%20using%20the%20default%20local%20storage%2C%20verify%20%60OPENDAL_FS_ROOT%3Dstorage%60%20and%20that%20the%20directory%20exists%20and%20has%20proper%20permissions%20%5B%5Breference%5D%28https%3A//github.com/langgenius/dify/blob/876f48df761d3a8e92b0d794942c16ff73e982d0/docker/.env.example%23L44-L1218%29%5D.%0A%0A4.%20Review%20your%20upload%20file%20size%20limits%20%28%60UPLOAD_FILE_SIZE_LIMIT%60%2C%20%60NGINX_CLIENT_MAX_BODY_SIZE%60%29%20and%20file%20extension%20blacklist%20%28%60UPLOAD_FILE_EXTENSION_BLACKLIST%60%29%20in%20your%20%60.env%60%20file.%20Blocked%20extensions%20or%20oversized%20files%20will%20cause%20errors%20%5B%5Breference%5D%28https%3A//github.com/langgenius/dify/pull/27540%29%5D.%0A%0A5.%20After%20making%20changes%2C%20restart%20your%20Docker%20containers%20for%20the%20new%20settings%20to%20take%20effect.%0A%0AIf%20uploads%20still%20fail%2C%20check%20the%20API%20and%20plugin%20container%20logs%20for%20detailed%20error%20messages%20or%20stack%20traces.%20This%20will%20help%20pinpoint%20whether%20the%20issue%20is%20with%20storage%2C%20permissions%2C%20or%20configuration%20%5B%5Breference%5D%28https%3A//github.com/langgenius/dify-official-plugins/issues/2110%29%5D.%0A%0ALet%20me%20know%20if%20you%20need%20help%20interpreting%20any%20log%20output%20or%20if%20you%20have%20more%20details%20from%20the%20server%20logs%21)&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/29071)
Author
Owner

@RoboSimonLee commented on GitHub (Dec 3, 2025):

For internal server errors please provide logs from the container instead.

Sorry to bother you, but where can I find the logs or which log is correct for your needs?

@RoboSimonLee commented on GitHub (Dec 3, 2025): > For internal server errors please provide logs from the container instead. Sorry to bother you, but where can I find the logs or which log is correct for your needs?
Author
Owner

@longbingljw commented on GitHub (Dec 3, 2025):

For internal server errors please provide logs from the container instead.

Sorry to bother you, but where can I find the logs or which log is correct for your needs?

docker logs -f docker-api-1

@longbingljw commented on GitHub (Dec 3, 2025): > > For internal server errors please provide logs from the container instead. > > Sorry to bother you, but where can I find the logs or which log is correct for your needs? docker logs -f docker-api-1
Author
Owner

@longbingljw commented on GitHub (Dec 3, 2025):

This could be a permission issue. I've encountered this before.

@longbingljw commented on GitHub (Dec 3, 2025): This could be a permission issue. I've encountered this before.
Author
Owner

@RoboSimonLee commented on GitHub (Dec 3, 2025):

This could be a permission issue. I've encountered this before.

2025-12-03 08:22:19.203 ERROR [Dummy-50] [app.py:875] - Exception on /console/api/files/upload [POST]
Traceback (most recent call last):
File "/app/api/.venv/lib/python3.12/site-packages/flask/app.py", line 917, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "/app/api/.venv/lib/python3.12/site-packages/flask/app.py", line 902, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/api/.venv/lib/python3.12/site-packages/flask_restx/api.py", line 404, in wrapper
resp = resource(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/api/.venv/lib/python3.12/site-packages/flask/views.py", line 110, in view
return current_app.ensure_sync(self.dispatch_request)(**kwargs) # type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/api/.venv/lib/python3.12/site-packages/flask_restx/resource.py", line 41, in dispatch_request
resp = meth(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/app/api/controllers/console/wraps.py", line 220, in decorated
return view(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/app/api/libs/login.py", line 80, in decorated_view
return current_app.ensure_sync(func)(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/api/controllers/console/wraps.py", line 37, in decorated
return view(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/app/api/.venv/lib/python3.12/site-packages/flask_restx/marshalling.py", line 246, in wrapper
resp = f(*args, **kwargs)
^^^^^^^^^^^^^^^^^^
File "/app/api/controllers/console/wraps.py", line 122, in decorated
return view(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/app/api/controllers/console/files.py", line 76, in post
upload_file = FileService(db.engine).upload_file(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/api/services/file_service.py", line 84, in upload_file
storage.save(file_key, content)
File "/app/api/extensions/ext_storage.py", line 89, in save
self.storage_runner.save(filename, data)
File "/app/api/extensions/storage/opendal_storage.py", line 44, in save
self.op.write(path=filename, bs=data)
opendal.exceptions.PermissionDenied: PermissionDenied (persistent) at write => permission denied

Context:
service: fs
path: upload_files/b59a0219-b172-401c-9a35-6f22b69c5d97/65b6f2ca-337a-49e0-a171-861a34ee9f60.docx

Source:
Permission denied (os error 13)

Yes, it's clearly the problem you mentioned.How to solve this, please

@RoboSimonLee commented on GitHub (Dec 3, 2025): > This could be a permission issue. I've encountered this before. 2025-12-03 08:22:19.203 ERROR [Dummy-50] [app.py:875] - Exception on /console/api/files/upload [POST] Traceback (most recent call last): File "/app/api/.venv/lib/python3.12/site-packages/flask/app.py", line 917, in full_dispatch_request rv = self.dispatch_request() ^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask/app.py", line 902, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask_restx/api.py", line 404, in wrapper resp = resource(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask/views.py", line 110, in view return current_app.ensure_sync(self.dispatch_request)(**kwargs) # type: ignore[no-any-return] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask_restx/resource.py", line 41, in dispatch_request resp = meth(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/app/api/controllers/console/wraps.py", line 220, in decorated return view(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/app/api/libs/login.py", line 80, in decorated_view return current_app.ensure_sync(func)(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/controllers/console/wraps.py", line 37, in decorated return view(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask_restx/marshalling.py", line 246, in wrapper resp = f(*args, **kwargs) ^^^^^^^^^^^^^^^^^^ File "/app/api/controllers/console/wraps.py", line 122, in decorated return view(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/app/api/controllers/console/files.py", line 76, in post upload_file = FileService(db.engine).upload_file( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/services/file_service.py", line 84, in upload_file storage.save(file_key, content) File "/app/api/extensions/ext_storage.py", line 89, in save self.storage_runner.save(filename, data) File "/app/api/extensions/storage/opendal_storage.py", line 44, in save self.op.write(path=filename, bs=data) opendal.exceptions.PermissionDenied: PermissionDenied (persistent) at write => permission denied Context: service: fs path: upload_files/b59a0219-b172-401c-9a35-6f22b69c5d97/65b6f2ca-337a-49e0-a171-861a34ee9f60.docx Source: Permission denied (os error 13) #### Yes, it's clearly the problem you mentioned.How to solve this, please
Author
Owner

@hjlarry commented on GitHub (Dec 3, 2025):

try this https://github.com/langgenius/dify/issues/29062#issuecomment-3605353061

@hjlarry commented on GitHub (Dec 3, 2025): try this https://github.com/langgenius/dify/issues/29062#issuecomment-3605353061
Author
Owner

@RoboSimonLee commented on GitHub (Dec 4, 2025):

try this #29062 (comment)

grateful for your help!

@RoboSimonLee commented on GitHub (Dec 4, 2025): > try this [#29062 (comment)](https://github.com/langgenius/dify/issues/29062#issuecomment-3605353061) grateful for your help!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#20764