diff --git a/frappe/model/document.py b/frappe/model/document.py
index 01d5847789..ebf5b9e95f 100644
--- a/frappe/model/document.py
+++ b/frappe/model/document.py
@@ -999,8 +999,12 @@ def execute_action(doctype, name, action, **kwargs):
getattr(doc, action)(**kwargs)
except frappe.ValidationError:
# add a comment (?)
- doc.add_comment('Comment',
- _('Action Failed') + '
' + json.loads(frappe.local.message_log[-1]).get('message'))
+ if frappe.local.message_log:
+ msg = json.loads(frappe.local.message_log[-1]).get('message')
+ else:
+ msg = '
' + frappe.get_traceback() + '
'
+
+ doc.add_comment('Comment', _('Action Failed') + '