Emptying the Trash Can

Some of the documents in the TrashCan still remains there after “bulk action=delete” or “EmptyTrashCan” command. Retried several times. Waited more than 30 minutes to see if anything happens differently, but still the same result.
Is there any way to force Trashcan clean up?
Thanks.

  • What version are you using?
  • How was it deployed?

There is no EmptyTrashCan command. Are you using a third party app or frontend?

Check the console log to see why the documents are not being deleted. Forcing the deletion of the documents in the trash when there is an problem is not recommended.

Sorry, wasn’t clear enough.
I have 4.9.1 installed on Docker on Win10.
I meant “Trash Can->Actions->EmptyTrash”. No third party.
I am seeing error messages in the frontend log like this:
2025-02-13 09:49:32 mayan.apps.logging.middleware.error_logging <1556> [ERROR] “process_exception() line 15 Exception caught by request middleware; <WSGIRequest: GET ‘/api/v4/trashed_documents/2771/image/?_hash=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855’>, [Errno 2] No such file or directory”
I still have docs in my TrashCan
Thanks.

The full log message. This repeats for several undeletable files in the trash can:

2025-02-13 09:58:01 mayan.apps.logging.middleware.error_logging <1607> [ERROR] “process_exception() line 15 Exception caught by request middleware; <WSGIRequest: GET ‘/api/v4/trashed_documents/2771/image/?_hash=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855’>, [Errno 2] No such file or directory”
2025-02-13 09:58:01 Traceback (most recent call last):
2025-02-13 09:58:01 File “/opt/mayan-edms/lib/python3.11/site-packages/django/core/handlers/base.py”, line 197, in _get_response
2025-02-13 09:58:01 response = wrapped_callback(request, *callback_args, **callback_kwargs)
2025-02-13 09:58:01 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-02-13 09:58:01 File “/opt/mayan-edms/lib/python3.11/site-packages/django/views/decorators/csrf.py”, line 56, in wrapper_view
2025-02-13 09:58:01 return view_func(*args, **kwargs)
2025-02-13 09:58:01 ^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-02-13 09:58:01 File “/opt/mayan-edms/lib/python3.11/site-packages/django/views/generic/base.py”, line 104, in view
2025-02-13 09:58:01 return self.dispatch(request, *args, **kwargs)
2025-02-13 09:58:01 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-02-13 09:58:01 File “/opt/mayan-edms/lib/python3.11/site-packages/rest_framework/views.py”, line 509, in dispatch
2025-02-13 09:58:01 response = self.handle_exception(exc)
2025-02-13 09:58:01 ^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-02-13 09:58:01 File “/opt/mayan-edms/lib/python3.11/site-packages/rest_framework/views.py”, line 469, in handle_exception
2025-02-13 09:58:01 self.raise_uncaught_exception(exc)
2025-02-13 09:58:01 File “/opt/mayan-edms/lib/python3.11/site-packages/rest_framework/views.py”, line 480, in raise_uncaught_exception
2025-02-13 09:58:01 raise exc
2025-02-13 09:58:01 File “/opt/mayan-edms/lib/python3.11/site-packages/rest_framework/views.py”, line 506, in dispatch
2025-02-13 09:58:01 response = handler(request, *args, **kwargs)
2025-02-13 09:58:01 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-02-13 09:58:01 File “/opt/mayan-edms/lib/python3.11/site-packages/rest_framework/generics.py”, line 212, in get
2025-02-13 09:58:01 return self.retrieve(request, *args, **kwargs)
2025-02-13 09:58:01 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-02-13 09:58:01 File “/opt/mayan-edms/lib/python3.11/site-packages/mayan/apps/converter/api_view_mixins.py”, line 47, in retrieve
2025-02-13 09:58:01 self.set_cache_file(request=request)
2025-02-13 09:58:01 File “/opt/mayan-edms/lib/python3.11/site-packages/mayan/apps/converter/api_view_mixins.py”, line 114, in set_cache_file
2025-02-13 09:58:01 cache_filename = task.get(**kwargs)
2025-02-13 09:58:01 ^^^^^^^^^^^^^^^^^^
2025-02-13 09:58:01 File “/opt/mayan-edms/lib/python3.11/site-packages/celery/result.py”, line 251, in get
2025-02-13 09:58:01 return self.backend.wait_for_pending(
2025-02-13 09:58:01 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-02-13 09:58:01 File “/opt/mayan-edms/lib/python3.11/site-packages/celery/backends/asynchronous.py”, line 223, in wait_for_pending
2025-02-13 09:58:01 return result.maybe_throw(callback=callback, propagate=propagate)
2025-02-13 09:58:01 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-02-13 09:58:01 File “/opt/mayan-edms/lib/python3.11/site-packages/celery/result.py”, line 365, in maybe_throw
2025-02-13 09:58:01 self.throw(value, self._to_remote_traceback(tb))
2025-02-13 09:58:01 File “/opt/mayan-edms/lib/python3.11/site-packages/celery/result.py”, line 358, in throw
2025-02-13 09:58:01 self.on_ready.throw(*args, **kwargs)
2025-02-13 09:58:01 File “/opt/mayan-edms/lib/python3.11/site-packages/vine/promises.py”, line 235, in throw
2025-02-13 09:58:01 reraise(type(exc), exc, tb)
2025-02-13 09:58:01 File “/opt/mayan-edms/lib/python3.11/site-packages/vine/utils.py”, line 27, in reraise
2025-02-13 09:58:01 raise value
2025-02-13 09:58:01 FileNotFoundError: [Errno 2] No such file or directory

Microsoft Windows does not have proper Docker or container support and will not work properly.

https://docs.mayan-edms.com/chapters/requirements.html

2025-02-13 09:49:32 mayan.apps.logging.middleware.error_logging <1556> [ERROR] “process_exception() line 15 Exception caught by request middleware; <WSGIRequest: GET ‘/api/v4/trashed_documents/2771/image/?_hash=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855’>, [Errno 2] No such file or directory”

A file associated with the document was deleted before the itself document was deleted.

When the database and the filesystem don’t match, Mayan will not delete the document in the database to prevent desynchronization, corruption, or orphan files.

This is a symptom that Mayan EDMS was not properly installed.

https://docs.mayan-edms.com/chapters/docker/install_docker_compose.html#docker-compose-install

Got it! Thanks for your quick responses.
I will continue using Mayan this way until it is really broken. It seems working fine for now except some leftovers in the trash can. I can still delete the newly trashed documents without problem.
Maybe a clean up fix can be implemented in the upcoming releases.