In one of the users in our ERPNext installation, we are getting this issue. All other users do not have this issue. we tried migrating and updating to latest version of ERPNext and frappe, but no solution was found.
Full error log below
App Versions
{
"chat": "0.0.1",
"eltech": "0.0.1",
"erpnext": "14.12.1",
"frappe": "14.22.1",
"hrms": "1.0.0",
"india_compliance": "14.1.1",
"payments": "0.0.1",
"whitelabel": "0.0.1"
}
Route
List/Opportunity/List
Trackeback
Syntax error in query:
SELECT `name` FROM `tabDocType` WHERE `name`='\' ORDER BY `modified` DESC LIMIT 1 None
Traceback (most recent call last):
File "apps/frappe/frappe/app.py", line 69, in application
response = frappe.api.handle()
File "apps/frappe/frappe/api.py", line 54, in handle
return frappe.handler.handle()
File "apps/frappe/frappe/handler.py", line 45, in handle
data = execute_cmd(cmd)
File "apps/frappe/frappe/handler.py", line 83, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File "apps/frappe/frappe/__init__.py", line 1590, in call
return fn(*args, **newargs)
File "apps/frappe/frappe/client.py", line 421, in validate_link
values.name = frappe.db.get_value(doctype, docname, cache=True)
File "apps/frappe/frappe/database/database.py", line 495, in get_value
result = self.get_values(
File "apps/frappe/frappe/database/database.py", line 592, in get_values
out = self._get_values_from_table(
File "apps/frappe/frappe/database/database.py", line 822, 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/database.py", line 218, in sql
self._cursor.execute(query, values)
File "env/lib/python3.10/site-packages/pymysql/cursors.py", line 148, in execute
result = self._query(query)
File "env/lib/python3.10/site-packages/pymysql/cursors.py", line 310, in _query
conn.query(q)
File "env/lib/python3.10/site-packages/pymysql/connections.py", line 548, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "env/lib/python3.10/site-packages/pymysql/connections.py", line 775, in _read_query_result
result.read()
File "env/lib/python3.10/site-packages/pymysql/connections.py", line 1156, in read
first_packet = self.connection._read_packet()
File "env/lib/python3.10/site-packages/pymysql/connections.py", line 725, in _read_packet
packet.raise_for_error()
File "env/lib/python3.10/site-packages/pymysql/protocol.py", line 221, in raise_for_error
err.raise_mysql_exception(self._data)
File "env/lib/python3.10/site-packages/pymysql/err.py", line 143, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''\\' ORDER BY `modified` DESC LIMIT 1' at line 1")
Request Data
{
"type": "POST",
"args": {
"doctype": "DocType",
"docname": "\\",
"fields": "[]"
},
"headers": {},
"error_handlers": {},
"url": "/api/method/frappe.client.validate_link"
}
Response Data
{
"exception": "pymysql.err.ProgrammingError: (1064, \"You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''\\\\' ORDER BY `modified` DESC LIMIT 1' at line 1\")"
}