Some emails do not send, in Error Log: "Communication not found"

some emails do not send with error frappe.exceptions.DoesNotExistError: Communication 178befe608 not found`

Email sending unstabile: about 60% emails was sent without error, but 40% emails gets error “Communication 178befe608 not found”

I think the problem is in the sequence of scheduled tasks, sometimes Communication has time to be created and then this message can be sent by Email Queue.

Sometimes the message doesn’t have time to be prepared and then another process “Email Queue” tries to send a Communication which hasn’t been created yet and then an error occurs.

bench --site enable-scheduler:
Enabled for

bench doctor output:
-----Checking scheduler status-----
Workers online: 3 Jobs-----

Error Log output:

`20:52:26 Traceback (most recent call last):
  File "/home/erpnext/frappe-bench/env/lib/python3.8/site-packages/rq/", line 1013, in perform_job
    rv = job.perform()
  File "/home/erpnext/frappe-bench/env/lib/python3.8/site-packages/rq/", line 709, in perform
    self._result = self._execute()
  File "/home/erpnext/frappe-bench/env/lib/python3.8/site-packages/rq/", line 732, in _execute
    result = self.func(*self.args, **self.kwargs)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/utils/", line 99, in execute_job
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/core/doctype/communication/", line 458, in sendmail
    communication = frappe.get_doc("Communication", communication_name)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/", line 855, in get_doc
    doc = frappe.model.document.get_doc(*args, **kwargs)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/model/", line 75, in get_doc
    return controller(*args, **kwargs)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/model/", line 113, in __init__
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/model/", line 156, in load_from_db
    frappe.throw(_("{0} {1} not found").format(_(self.doctype),, frappe.DoesNotExistError)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/", line 437, in throw
    msgprint(msg, raise_exception=exc, title=title, indicator='red', is_minimizable=is_minimizable, wide=wide, as_list=as_list)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/", line 416, in msgprint
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/", line 370, in _raise_exception
    raise raise_exception(msg)
frappe.exceptions.DoesNotExistError: Communication 178befe608 not found`

Facing similar issue, have raised a GitHub issue.

This release resolved problem.
After update and test, all emails was sent.