Unable to Reply to Customer Ticket

Hey,

I am currently unable to reply to a customer’s Helpdesk ticket. Whenever I attempt to respond using the “Reply via Agent” option, the action fails and the reply is not sent.

I took a moment to check the error logs, and from what I can understand it appears to be related to a Lock wait timeout exceeded database error.

Below are the logs captured at the time of the failure for your reference:

Traceback with variables (most recent call last):
File “apps/frappe/frappe/app.py”, line 121, in application
response = frappe.api.handle(request)
request = <Request ‘``https://meckeys-support.m.frappe.cloud/api/method/run_doc_method``’ [POST]>
response = None
e = (1205, ‘Lock wait timeout exceeded; try restarting transaction’)
File “apps/frappe/frappe/api/init.py”, line 63, in handle
data = endpoint(**arguments)
request = <Request ‘``https://meckeys-support.m.frappe.cloud/api/method/run_doc_method``’ [POST]>
endpoint = <function handle_rpc_call at 0x7fe2f00f4e00>
arguments = {‘method’: ‘run_doc_method’}
File “apps/frappe/frappe/api/v1.py”, line 40, in handle_rpc_call
return frappe.handler.handle()
method = ‘run_doc_method’
frappe = <module ‘frappe’ from ‘apps/frappe/frappe/init.py’>
File “apps/frappe/frappe/handler.py”, line 53, in handle
data = execute_cmd(cmd)
cmd = ‘run_doc_method’
data = None
File “apps/frappe/frappe/handler.py”, line 86, in execute_cmd
return frappe.call(method, **frappe.form_dict)
cmd = ‘run_doc_method’
from_async = False
server_script = None
method = <function run_doc_method at 0x7fe2edefbab0>
File “apps/frappe/frappe/init.py”, line 1129, in call
return fn(*args, **newargs)
fn = <function run_doc_method at 0x7fe2edefbab0>
args = ()
kwargs = {‘dt’: ‘HD Ticket’, ‘dn’: ‘3284’, ‘method’: ‘reply_via_agent’, ‘args’: {‘attachments’: , ‘to’: ‘aishwaryraj.personal@gmail.com’, ‘cc’: ‘’, ‘bcc’: ‘’, ‘message’: ‘Hi Aishwary,Thank you for filling in the RMA formCould you please provide a video and a description of the issue so that our team can review it.Appreciate your support and understandingBest RegardsTeam RMAMeckeys’}, ‘cmd’: ‘run_doc_method’}
newargs = {‘dt’: ‘HD Ticket’, ‘dn’: ‘3284’, ‘method’: ‘reply_via_agent’, ‘args’: {‘attachments’: , ‘to’: ‘aishwaryraj.personal@gmail.com’, ‘cc’: ‘’, ‘bcc’: ‘’, ‘message’: ‘Hi Aishwary,Thank you for filling in the RMA formCould you please provide a video and a description of the issue so that our team can review it.Appreciate your support and understandingBest RegardsTeam RMAMeckeys’}}
File “apps/frappe/frappe/handler.py”, line 302, in run_doc_method
response = doc.run_method(method, **args)
method = ‘reply_via_agent’
docs = None
dt = ‘HD Ticket’
dn = ‘3284’
arg = None
args = {‘attachments’: , ‘to’: ‘aishwaryraj.personal@gmail.com’, ‘cc’: ‘’, ‘bcc’: ‘’, ‘message’: ‘Hi Aishwary,Thank you for filling in the RMA formCould you please provide a video and a description of the issue so that our team can review it.Appreciate your support and understandingBest RegardsTeam RMAMeckeys’}
signature = <function signature at 0x7fe2f3020040>
doc = HD Ticket (3284)
method_obj = <bound method HDTicket.reply_via_agent of <HDTicket: doctype=HD Ticket 3284>>
fn = <function HDTicket.reply_via_agent at 0x7fe2e6f53060>
fnargs = [‘message’, ‘to’, ‘cc’, ‘bcc’, ‘attachments’]
File “apps/frappe/frappe/model/document.py”, line 1181, in run_method
out = Document.hook(fn)(self, *args, kwargs)
self = HD Ticket (3284)
method = ‘reply_via_agent’
args = ()
kwargs = {‘attachments’: [], ‘to’: ‘aishwaryraj.personal@gmail.com’, ‘cc’: ‘’, ‘bcc’: ‘’, ‘message’: ‘Hi Aishwary,Thank you for filling in the RMA formCould you please provide a video and a description of the issue so that our team can review it.Appreciate your support and understandingBest RegardsTeam RMAMeckeys’}
fn = <function Document.run_method..fn at 0x7fe27122ceb0>
File “apps/frappe/frappe/model/document.py”, line 1578, in composer
return composed(self, method, args, **kwargs)
self = HD Ticket (3284)
args = ()
kwargs = {‘attachments’: [], ‘to’: ‘aishwaryraj.personal@gmail.com’, ‘cc’: ‘’, ‘bcc’: ‘’, ‘message’: ‘Hi Aishwary,Thank you for filling in the RMA formCould you please provide a video and a description of the issue so that our team can review it.Appreciate your support and understandingBest RegardsTeam RMAMeckeys’}
hooks = []
method = ‘reply_via_agent’
doc_events = {'
': {‘on_update’: [‘frappe.desk.notifications.clear_doctype_notifications’, ‘frappe.workflow.doctype.workflow_action.workflow_action.process_workflow_actions’, ‘frappe.core.doctype.file.utils.attach_files_to_document’, ‘frappe.automation.doctype.assignment_rule.assignment_rule.apply’, ‘frappe.automation.doctype.assignment_rule.assignment_rule.update_due_date’, ‘frappe.core.doctype.user_type.user_type.apply_permissions_for_non_standard_user_type’, ‘frappe.core.doctype.permission_log.permission_log.make_perm_log’, ‘frappe.search.sqlite_search.update_doc_index’], ‘after_rename’: [‘frappe.desk.notifications.clear_doctype_notifications’], ‘on_cancel’: [‘frappe.desk.notifications.clear_doctype_n…build_domain_restricted_doctype_cache’]}, ‘Page’: {‘on_update’: [‘frappe.cache_manager.build_domain_restricted_page_cache’]}, ‘Assignment Rule’: {‘on_trash’: [‘helpdesk.extends.assignment_rule.on_assignment_rule_trash’], ‘validate’: [‘helpdesk.extends.assignment_rule.on_assignment_rule_validate’]}}
composed = <function Document.hook..compose..runner at 0x7fe27122d010>
compose = <function Document.hook..compose at 0x7fe27122d0c0>
f = <function Document.run_method..fn at 0x7fe27122ceb0>
File “apps/frappe/frappe/model/document.py”, line 1556, in runner
add_to_return_value(self, fn(self, *args, kwargs))
self = HD Ticket (3284)
method = ‘reply_via_agent’
args = ()
kwargs = {‘attachments’: [], ‘to’: ‘aishwaryraj.personal@gmail.com’, ‘cc’: ‘’, ‘bcc’: ‘’, ‘message’: ‘Hi Aishwary,Thank you for filling in the RMA formCould you please provide a video and a description of the issue so that our team can review it.Appreciate your support and understandingBest RegardsTeam RMAMeckeys’}
add_to_return_value = <function Document.hook..add_to_return_value at 0x7fe27122cf60>
fn = <function Document.run_method..fn at 0x7fe27122ceb0>
hooks = ()
File “apps/frappe/frappe/model/document.py”, line 1178, in fn
return method_object(*args, kwargs)
self = HD Ticket (3284)
args = ()
kwargs = {‘attachments’: [], ‘to’: ‘aishwaryraj.personal@gmail.com’, ‘cc’: ‘’, ‘bcc’: ‘’, ‘message’: ‘Hi Aishwary,Thank you for filling in the RMA formCould you please provide a video and a description of the issue so that our team can review it.Appreciate your support and understandingBest RegardsTeam RMAMeckeys’}
method_object = <bound method HDTicket.reply_via_agent of <HDTicket: doctype=HD Ticket 3284>>
method = ‘reply_via_agent’
File “apps/frappe/frappe/utils/typing_validations.py”, line 36, in wrapper
return func(*args, kwargs)
args = [HD Ticket (3284)]
kwargs = {‘attachments’: [], ‘to’: ‘aishwaryraj.personal@gmail.com’, ‘cc’: ‘’, ‘bcc’: ‘’, ‘message’: ‘Hi Aishwary,Thank you for filling in the RMA formCould you please provide a video and a description of the issue so that our team can review it.Appreciate your support and understandingBest RegardsTeam RMAMeckeys’}
apply_condition = <function _in_request_or_test at 0x7fe2f1a401a0>
func = <function HDTicket.reply_via_agent at 0x7fe2e6f52fb0>
File “apps/helpdesk/helpdesk/helpdesk/doctype/hd_ticket/hd_ticket.py”, line 609, in reply_via_agent
communication.insert(ignore_permissions=True)
self = HD Ticket (3284)
message = ‘Hi Aishwary,Thank you for filling in the RMA formCould you please provide a video and a description of the issue so that our team can review it.Appreciate your support and understandingBest RegardsTeam RMAMeckeys’
to = ‘aishwaryraj.personal@gmail.com’
cc = ‘’
bcc = ‘’
attachments = []
skip_email_workflow = False
medium = ‘Email’
subject = ‘Re: Order
#106843: VXE MADR’
sender = ‘minakshi.mohapatra@meckeys.com’
recipients = ‘aishwaryraj.personal@gmail.com’
sender_email = {‘name’: ‘Support’, ‘creation’: datetime.datetime(2026, 1, 22, 19, 4, 26, 428793), ‘modified’: datetime.datetime(2026, 3, 16, 12, 50, 7, 623334), ‘modified_by’: ‘Administrator’, ‘owner’: ‘abhinay@meckeys.com’, ‘docstatus’: 0, ‘idx’: 638, ‘email_id’: ‘support@meckeys.in’, ‘email_account_name’: ‘Support’, ‘domain’: None, ‘service’: ‘GMail’, ‘auth_method’: ‘Basic’, ‘backend_app_flow’: 0, ‘password’: '
‘, ‘awaiting_password’: 0, ‘ascii_encode_password’: 0, ‘connected_app’: None, ‘connected_user’: None, ‘login_id_is_different’: 0, ‘login_id’: None, ‘enable_incoming’: 1, ‘default_incoming’: 0, ‘use_imap’: 1, ‘use_ssl’: 1, ‘use_starttls’: 0, ‘email_server’: ‘``imap.gmail.com``’, ‘incoming_port’:…ags’: None, ‘_comments’: None, ‘_assign’: None, ‘_liked_by’: None, ‘company’: None, ‘frappe_mail_site’: ‘``https://frappemail.com``’, ‘api_key’: None, ‘api_secret’: None, ‘last_received_at’: None, ‘validate_ssl_certificate’: 1, ‘add_x_original_from’: 1, ‘add_reply_to_header’: 1, ‘dsn_notify_type’: None}
communication = Communication (dp7nkba3uj)
last_communication = None
File “apps/frappe/frappe/model/document.py”, line 474, in insert
self.run_post_save_methods()
self = Communication (dp7nkba3uj)
ignore_permissions = True
ignore_links = None
ignore_if_duplicate = False
ignore_mandatory = None
set_name = None
set_child_names = True
d = Communication Link (dp7na0do9n)
File “apps/frappe/frappe/model/document.py”, line 1375, in run_post_save_methods
self.run_method(“on_update”)
self = Communication (dp7nkba3uj)
File “apps/frappe/frappe/model/document.py”, line 1181, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
self = Communication (dp7nkba3uj)
method = ‘on_update’
args = ()
kwargs = {}
fn = <function Document.run_method..fn at 0x7fe27122cbf0>
File “apps/frappe/frappe/model/document.py”, line 1578, in composer
return composed(self, method, args, **kwargs)
self = Communication (dp7nkba3uj)
args = ()
kwargs = {}
hooks = [<function clear_doctype_notifications at 0x7fe2ed46c930>, <function process_workflow_actions at 0x7fe2e6962fb0>, <function attach_files_to_document at 0x7fe2f0f65010>, <function apply at 0x7fe2e6979430>, <function update_due_date at 0x7fe2e69794e0>, <function apply_permissions_for_non_standard_user_type at 0x7fe2ed46c1a0>, <function make_perm_log at 0x7fe2e6979900>, <function update_doc_index at 0x7fe2e69ae140>]
method = ‘on_update’
doc_events = {'
‘: {‘on_update’: [‘frappe.desk.notifications.clear_doctype_notifications’, ‘frappe.workflow.doctype.workflow_action.workflow_action.process_workflow_actions’, ‘frappe.core.doctype.file.utils.attach_files_to_document’, ‘frappe.automation.doctype.assignment_rule.assignment_rule.apply’, ‘frappe.automation.doctype.assignment_rule.assignment_rule.update_due_date’, ‘frappe.core.doctype.user_type.user_type.apply_permissions_for_non_standard_user_type’, ‘frappe.core.doctype.permission_log.permission_log.make_perm_log’, ‘frappe.search.sqlite_search.update_doc_index’], ‘after_rename’: [‘frappe.desk.notifications.clear_doctype_notifications’], ‘on_cancel’: [‘frappe.desk.notifications.clear_doctype_n…build_domain_restricted_doctype_cache’]}, ‘Page’: {‘on_update’: [‘frappe.cache_manager.build_domain_restricted_page_cache’]}, ‘Assignment Rule’: {‘on_trash’: [‘helpdesk.extends.assignment_rule.on_assignment_rule_trash’], ‘validate’: [‘helpdesk.extends.assignment_rule.on_assignment_rule_validate’]}}
handler = ‘frappe.search.sqlite_search.update_doc_index’
composed = <function Document.hook..compose..runner at 0x7fe2714217a0>
compose = <function Document.hook..compose at 0x7fe2714216f0>
f = <function Document.run_method..fn at 0x7fe27122cbf0>
File “apps/frappe/frappe/model/document.py”, line 1556, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
self = Communication (dp7nkba3uj)
method = ‘on_update’
args = ()
kwargs = {}
add_to_return_value = <function Document.hook..add_to_return_value at 0x7fe271421640>
fn = <function Document.run_method..fn at 0x7fe27122cbf0>
hooks = (<function clear_doctype_notifications at 0x7fe2ed46c930>, <function process_workflow_actions at 0x7fe2e6962fb0>, <function attach_files_to_document at 0x7fe2f0f65010>, <function apply at 0x7fe2e6979430>, <function update_due_date at 0x7fe2e69794e0>, <function apply_permissions_for_non_standard_user_type at 0x7fe2ed46c1a0>, <function make_perm_log at 0x7fe2e6979900>, <function update_doc_index at 0x7fe2e69ae140>)
File “apps/frappe/frappe/model/document.py”, line 1178, in fn
return method_object(*args, *kwargs)
self = Communication (dp7nkba3uj)
args = ()
kwargs = {}
method_object = <bound method Communication.on_update of <Communication: doctype=Communication dp7nkba3uj>>
method = ‘on_update’
File “apps/frappe/frappe/core/doctype/communication/communication.py”, line 245, in on_update
update_comment_in_doc(self)
self = Communication (dp7nkba3uj)
File “apps/frappe/frappe/core/doctype/comment/comment.py”, line 152, in update_comment_in_doc
update_comments_in_parent(doc.reference_doctype, doc.reference_name, _comments)
doc = Communication (dp7nkba3uj)
get_truncated = <function update_comment_in_doc..get_truncated at 0x7fe2714214e0>
_comments = [{‘comment’: ‘Hi Aishwary,Thank you for filling in the RMA formCould you please provide a vide…’, ‘by’: ‘minakshi.mohapatra@meckeys.com’, ‘name’: ‘dp7nkba3uj’}]
updated = False
File “apps/frappe/frappe/core/doctype/comment/comment.py”, line 193, in update_comments_in_parent
frappe.db.sql(
reference_doctype = ‘HD Ticket’
reference_name = 3284
_comments = [{‘comment’: ‘Hi Aishwary,Thank you for filling in the RMA formCould you please provide a vide…’, ‘by’: ‘minakshi.mohapatra@meckeys.com’, ‘name’: ‘dp7nkba3uj’}]
File “apps/frappe/frappe/database/database.py”, line 281, in sql
raise frappe.QueryTimeoutError(e) from e
self = frappe.database.mariadb.mysqlclient.MariaDBDatabase(after_commit=frappe.utils.CallbackManager(-), after_rollback=frappe.utils.CallbackManager(-), auto_commit_on_many_writes=0, before_commit=frappe.utils.CallbackManager(-), before_rollback=frappe.utils.CallbackManager(-), cur_db_name=‘_0d15f969bdb326c3’, db_type=‘mariadb’, host=‘10.3.5.51’, last_query='SELECT issingle FROM tabDocType WHERE name=‘HD Ticket’ ORDER BY creation DESC LIMIT 1 /
FRAPPE_TRACE_ID: c79c5d55-7ecd-4c08-a4ea-ed0bb30add6d/', logger=<Logger database-meckeys-support.m.frappe.cloud (WARNING)>, password=‘ayijBqdGxhVnjCoV’, port=3306, socket=None, transaction_writes=4, type_map={‘Currency’: (‘decimal’, ‘21,9’), ‘I…port’: collections.defaultdict{(‘name’, ‘company’): [frappe.types.frappedict._dict{‘name’: ‘Support’, ‘company’: None}]}}, ‘User’: collections.defaultdict{‘minakshi.mohapatra@meckeys.com’: collections.defaultdict{(‘name’): [frappe.types.frappedict._dict{‘name’: ‘minakshi.mohapatra@meckeys.com’}]}}})
query = 'update tabHD Ticket set _comments=%s where name=%s /
FRAPPE_TRACE_ID: c79c5d55-7ecd-4c08-a4ea-ed0bb30add6d */’
values = (‘[{“comment”: “Hi Aishwary,Thank you for filling in the RMA formCould you please provide a vide…”, “by”: “``minakshi.mohapatra@meckeys.com``”, “name”: “dp7nkba3uj”}]’, 3284)
as_dict = 0
as_list = 0
debug = False
ignore_ddl = 0
auto_commit = 0
update = None
explain = False
run = True
pluck = False
as_iterator = False
query_type = ‘update’
trace_id = ‘c79c5d55-7ecd-4c08-a4ea-ed0bb30add6d’
frappe.exceptions.QueryTimeoutError: (1205, ‘Lock wait timeout exceeded; try restarting transaction’)

Could you please help investigate this issue and advise on how it can be resolved?

Thank you.

1 Like

It same like the same ticket updating or opening with another agent at the same time or something stacking on the queue, so you can check for concurrency editing at the same time at the same ticket