ERPNext showing a random mysql operational error because of my users. Cant logout

I set up a fresh install of ERPNext with typical master data. However, once I started to create different users with different roles and modules allowed, my ERPNext started break by not allowing me to logout or generating a MySQL operational error. I cannot repeat the alert as it appears randomly. However, I can repeat another error by trying to save my users and when i do try to save it shows “tenacity.RetryError: RetryError[]”. I attached the image of the error and the error stack below. Can any help me out here? I managed to narrow down the error to only the users as I am able to save in order documents.

Thank you!

### App Versions

“erpnext”: “14.1.2”,
“frappe”: “14.8.0”,
“payments”: “0.0.1”

### Route


### Trackeback

Traceback (most recent call last):
File “apps/frappe/frappe/”, line 55, in application
File “apps/frappe/frappe/”, line 132, in init_request
frappe.local.http_request = frappe.auth.HTTPRequest()
File “apps/frappe/frappe/”, line 34, in init
File “apps/frappe/frappe/”, line 68, in set_session
frappe.local.login_manager = LoginManager()
File “apps/frappe/frappe/”, line 117, in init
File “apps/frappe/frappe/”, line 205, in make_session
frappe.local.session_obj = Session(
File “apps/frappe/frappe/”, line 238, in init
File “apps/frappe/frappe/”, line 310, in resume
File “apps/frappe/frappe/”, line 413, in validate_ip_address
frappe.get_cached_value(“User”, user, user_fields, as_dict=True)
File “apps/frappe/frappe/”, line 1155, in get_cached_value
doc = get_cached_doc(doctype, name, _allow_dict=True)
File “apps/frappe/frappe/”, line 1100, in get_cached_doc
doc = get_doc(*args, **kwargs)
File “apps/frappe/frappe/”, line 1189, in get_doc
doc = frappe.model.document.get_doc(*args, **kwargs)
File “apps/frappe/frappe/model/”, line 74, in get_doc
return controller(*args, **kwargs)
File “apps/frappe/frappe/model/”, line 106, in init
File “apps/frappe/frappe/model/”, line 132, in load_from_db
if not getattr(self, “_metaclass”, False) and self.meta.issingle:
File “apps/frappe/frappe/model/”, line 118, in meta
self._meta = meta = frappe.get_meta(self.doctype)
File “apps/frappe/frappe/”, line 1220, in get_meta
return frappe.model.meta.get_meta(doctype, cached=cached)
File “apps/frappe/frappe/model/”, line 51, in get_meta
meta = Meta(doctype)
File “apps/frappe/frappe/model/”, line 114, in init
File “apps/frappe/frappe/model/”, line 135, in process
File “apps/frappe/frappe/model/”, line 498, in set_custom_permissions
custom_perms = frappe.get_all(
File “apps/frappe/frappe/”, line 1915, in get_all
return get_list(doctype, *args, **kwargs)
File “apps/frappe/frappe/”, line 1887, in get_list
return frappe.model.db_query.DatabaseQuery(doctype).execute(*args, **kwargs)
File “apps/frappe/frappe/model/”, line 172, in execute
result = self.build_and_run()
File “apps/frappe/frappe/model/”, line 187, in build_and_run
args = self.prepare_args()
File “apps/frappe/frappe/model/”, line 226, in prepare_args
File “apps/frappe/frappe/model/”, line 523, in build_conditions
self.build_filter_conditions(self.filters, self.conditions)
File “apps/frappe/frappe/model/”, line 544, in build_filter_conditions
File “apps/frappe/frappe/model/”, line 556, in prepare_filter_condition
f = get_filter(self.doctype, f, additional_filters_config)
File “apps/frappe/frappe/utils/”, line 1779, in get_filter
df = frappe.get_meta(f.doctype).get_field(f.fieldname)
File “apps/frappe/frappe/”, line 1220, in get_meta
return frappe.model.meta.get_meta(doctype, cached=cached)
File “apps/frappe/frappe/model/”, line 51, in get_meta
meta = Meta(doctype)
File “apps/frappe/frappe/model/”, line 113, in init
super().init(“DocType”, doctype)
File “apps/frappe/frappe/model/”, line 106, in init
File “apps/frappe/frappe/model/”, line 118, in load_from_db
File “apps/frappe/frappe/model/”, line 163, in load_from_db
File “apps/frappe/frappe/database/”, line 570, in get_values
out = self._get_values_from_table(
File “apps/frappe/frappe/database/”, line 800, in _get_values_from_table
return self.sql(query, as_dict=as_dict, debug=debug, update=update, run=run, pluck=pluck)
File “apps/frappe/frappe/database/”, line 207, in sql
self._cursor.execute(query, values)
File “env/lib/python3.10/site-packages/pymysql/”, line 148, in execute
result = self._query(query)
File “env/lib/python3.10/site-packages/pymysql/”, line 310, in _query
File “env/lib/python3.10/site-packages/pymysql/”, line 548, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File “env/lib/python3.10/site-packages/pymysql/”, line 775, in _read_query_result
File “env/lib/python3.10/site-packages/pymysql/”, line 1156, in read
first_packet = self.connection._read_packet()
File “env/lib/python3.10/site-packages/pymysql/”, line 725, in _read_packet
File “env/lib/python3.10/site-packages/pymysql/”, line 221, in raise_for_error
File “env/lib/python3.10/site-packages/pymysql/”, line 143, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.OperationalError: (1052, “Column ‘parent’ in where clause is ambiguous”)

### Request Data

“type”: “POST”,
“args”: {},
“headers”: {},
“error_handlers”: {},
“url”: “/api/method/”

### Response Data

“exception”: “pymysql.err.OperationalError: (1052, "Column ‘parent’ in where clause is ambiguous")”