Error when Deleting Customer

I get this error when deleting a customer. This is in ERPNext: v10.1.14, can someone tell me what table the field is missing from please? I don’t know how to find the table that is having the missing field.

Traceback (most recent call last):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/", line 62, in application
    response = frappe.handler.handle()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/", line 22, in handle
    data = execute_cmd(cmd)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/", line 53, in execute_cmd
    return, **frappe.form_dict)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/", line 939, in call
    return fn(*args, **newargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/", line 215, in delete
    frappe.delete_doc(doctype, name, ignore_missing=False)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/", line 673, in delete_doc
    ignore_permissions, flags, ignore_on_trash, ignore_missing)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/", line 87, in delete_doc
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/", line 190, in check_if_doc_is_linked
    ["name", "parent", "parenttype", "docstatus"], as_dict=True):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/", line 487, in get_values
    out = self._get_values_from_table(fields, filters, doctype, as_dict, debug, order_by, update)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/", line 619, in _get_values_from_table
    as_dict=as_dict, debug=debug, update=update)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/", line 166, in sql
    self._cursor.execute(query, values)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/", line 165, in execute
    result = self._query(query)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/", line 321, in _query
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/", line 860, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/", line 1061, in _read_query_result
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/", line 1349, in read
    first_packet = self.connection._read_packet()
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/", line 1018, in _read_packet
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/", line 384, in check_error
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/", line 107, in raise_mysql_exception
    raise errorclass(errno, errval)
InternalError: (1054, u"Unknown column 'parent' in 'field list'")

Thank you all!

Looks weird, you need to add a print here to see which DocType does not have parent column. Unless you have customized, all DocTypes have the parent column

Thank you for taking the time to look into this issue, I really appreciate your help.

This is what is in that line. Where can I add that print code (sorry I am a noob at Python)

# delete from child tables
for t in list(set(tables)):
        if t not in ignore_doctypes:
                frappe.db.sql("delete from `tab%s` where parenttype=%s and parent = %s" % (t, '%s', '%s'), (doctype, name))

def update_flags(doc, flags=None, ignore_permissions=False):
if ignore_permissions:
        if not flags: flags = {}
        flags["ignore_permissions"] = ignore_permissions

if flags:

def check_permission_and_not_submitted(doc):
# permission
if (not doc.flags.ignore_permissions
        and frappe.session.user!="Administrator"
        and (
                not doc.has_permission("delete")
                or (doc.doctype=="DocType" and not doc.custom))):
        frappe.msgprint(_("User not allowed to delete {0}: {1}")
                .format(doc.doctype,, raise_exception=frappe.PermissionError)

# check if submitted
if doc.docstatus == 1:
        frappe.msgprint(_("{0} {1}: Submitted Record cannot be deleted.").format(_(doc.doctype),,

Thank you for all your help on this!

Any thoughts on this?

Did you recently update ? Was it working earlier ? Generally you get these when the table cols does not match with patches required to be applied or when customised cols went wrong…

No this issue was happening in the v8 and v10. I was thinking that the upgrade would fix it. But it didn’t. I would like the error to tell me what doctype is causing so I can see if I can patch it. I just don’t know how to add a print line in python so it can tell me that doctype’s name.

I do think it’s a customized column that one of our guys added. Thanks for that help!