Unexpected exception while trying to create version for new document - 'Layer' object has no attribute 'add_to_object'
When trying to upload a document (either via web or staging/watch) I'm getting the below error. This only seems to be happening to one specific document. The document is scanned in the same way as all other documents and is a standard PDF.
It copies the pdf to the document_storage successfully but does not appear to actually add the document.
Looking into the database there isn't anything in the documents_document table matching the document ID generated nor anything in the documents_documentversion table matching the ID or date/time.
The document does however seem to get copied into the shared_files directory as well (but with a different ID than the ID of the filename).
It makes me wonder if there's something left in the database from the initial first upload attempt and if this is blocking further attempts. Is there anyway to validate any dangling references where documents exist in the DB but not on the filesystem so they can be pruned?
Here's the error from the logs:
[2019-12-14 16:44:51,597: INFO/MainProcess] Received task: mayan.apps.sources.tasks.task_upload_document[fb69f4ab-3641-4092-9b10-c779ac639858]
[2019-12-14 16:44:51,597: INFO/ForkPoolWorker-3] Task mayan.apps.sources.tasks.task_source_handle_upload[d811ba09-e1ce-468c-a88c-9c1ec792bb82] succeeded in 0.031785895000211895s: None
mayan.apps.documents.models.document_version_models <751130> [ERROR] "save() line 325 Error creating new document version for document "Nuffield Health SAR.pdf"; 'Layer' object has no attribute 'add_to_object'"
[2019-12-14 16:44:52,664: ERROR/ForkPoolWorker-1] Error creating new document version for document "Nuffield Health SAR.pdf"; 'Layer' object has no attribute 'add_to_object'
mayan.apps.sources.models.base <751130> [CRITICAL] "upload_document() line 143 Unexpected exception while trying to create version for new document "Nuffield Health SAR.pdf" from source "Web Upload"; 'Layer' object has no attribute 'add_to_object'"
Traceback (most recent call last):
File "/opt/mayan-edms/local/lib/python3.7/site-packages/mayan/apps/sources/models/base.py", line 129, in upload_document
file_object=file_object, _user=user,
File "/opt/mayan-edms/local/lib/python3.7/site-packages/mayan/apps/documents/models/document_models.py", line 179, in new_version
document_version.save(_user=_user)
File "/opt/mayan-edms/local/lib/python3.7/site-packages/mayan/apps/documents/models/document_version_models.py", line 310, in save
self.fix_orientation()
File "/opt/mayan-edms/local/lib/python3.7/site-packages/mayan/apps/documents/models/document_version_models.py", line 159, in fix_orientation
layer_saved_transformations.add_to_object(
AttributeError: 'Layer' object has no attribute 'add_to_object'
[2019-12-14 16:44:52,664: CRITICAL/ForkPoolWorker-1] Unexpected exception while trying to create version for new document "Nuffield Health SAR.pdf" from source "Web Upload"; 'Layer' object has no attribute 'add_to_object'
Traceback (most recent call last):
File "/opt/mayan-edms/local/lib/python3.7/site-packages/mayan/apps/sources/models/base.py", line 129, in upload_document
file_object=file_object, _user=user,
File "/opt/mayan-edms/local/lib/python3.7/site-packages/mayan/apps/documents/models/document_models.py", line 179, in new_version
document_version.save(_user=_user)
File "/opt/mayan-edms/local/lib/python3.7/site-packages/mayan/apps/documents/models/document_version_models.py", line 310, in save
self.fix_orientation()
File "/opt/mayan-edms/local/lib/python3.7/site-packages/mayan/apps/documents/models/document_version_models.py", line 159, in fix_orientation
layer_saved_transformations.add_to_object(
AttributeError: 'Layer' object has no attribute 'add_to_object'
==> /var/log/supervisor/mayan-worker-indexing-stderr---supervisor-Hfy57K.log <==
[2019-12-14 16:44:52,694: INFO/MainProcess] Received task: mayan.apps.document_indexing.tasks.task_remove_document[83121055-3e60-4902-9a97-bb6ef079cfb7]
[2019-12-14 16:44:52,700: INFO/MainProcess] Received task: mayan.apps.document_indexing.tasks.task_delete_empty[5c8c5748-a336-424d-b1ea-84a1c690d946]
==> /var/log/supervisor/mayan-worker-file-stderr---supervisor-iM1nVB.log <==
[2019-12-14 16:44:52,702: INFO/MainProcess] Received task: mayan.apps.documents.tasks.task_clean_empty_duplicate_lists[02115cef-fe4e-44e6-9695-b53a8d546aa3]
[2019-12-14 16:44:52,708: ERROR/ForkPoolWorker-1] Task mayan.apps.sources.tasks.task_upload_document[fb69f4ab-3641-4092-9b10-c779ac639858] raised unexpected: AttributeError("'Layer' object has no attribute 'add_to_object'")
Traceback (most recent call last):
File "/opt/mayan-edms/local/lib/python3.7/site-packages/celery/app/trace.py", line 385, in trace_task
R = retval = fun(*args, **kwargs)
File "/opt/mayan-edms/local/lib/python3.7/site-packages/celery/app/trace.py", line 648, in __protected_call__
return self.run(*args, **kwargs)
File "/opt/mayan-edms/local/lib/python3.7/site-packages/mayan/apps/sources/tasks.py", line 193, in task_upload_document
querystring=querystring, user=user,
File "/opt/mayan-edms/local/lib/python3.7/site-packages/mayan/apps/sources/models/base.py", line 129, in upload_document
file_object=file_object, _user=user,
File "/opt/mayan-edms/local/lib/python3.7/site-packages/mayan/apps/documents/models/document_models.py", line 179, in new_version
document_version.save(_user=_user)
File "/opt/mayan-edms/local/lib/python3.7/site-packages/mayan/apps/documents/models/document_version_models.py", line 310, in save
self.fix_orientation()
File "/opt/mayan-edms/local/lib/python3.7/site-packages/mayan/apps/documents/models/document_version_models.py", line 159, in fix_orientation
layer_saved_transformations.add_to_object(
AttributeError: 'Layer' object has no attribute 'add_to_object'
[2019-12-14 16:44:52,711: INFO/ForkPoolWorker-2] Task mayan.apps.documents.tasks.task_clean_empty_duplicate_lists[02115cef-fe4e-44e6-9695-b53a8d546aa3] succeeded in 0.007921664044260979s: None
==> /var/log/supervisor/mayan-worker-indexing-stderr---supervisor-Hfy57K.log <==
[2019-12-14 16:44:52,814: INFO/ForkPoolWorker-1] Task mayan.apps.document_indexing.tasks.task_remove_document[83121055-3e60-4902-9a97-bb6ef079cfb7] succeeded in 0.11960337799973786s: None
[2019-12-14 16:44:52,943: INFO/ForkPoolWorker-1] Task mayan.apps.document_indexing.tasks.task_delete_empty[5c8c5748-a336-424d-b1ea-84a1c690d946] succeeded in 0.12738030799664557s: None```