Strange Error while accessing Doctype - tabSales Invoice does not exist? - only fix is to restart bench


I have a multitenant environment in which one of the site just has Frappe and a Custom app installed ( No ERPNext whatsoever). Still today when I tried to access one of the Doctype’s list, it gave me a bizarre error “Table ‘2f041c57b7cf613b.tabSales Invoice’ doesn’t exist” This is the second time I have gotten this error. Doing a bench start resolved my problem. Worth to mention that I have ERPNext installed in other sites. Have any else faced this issue ? Any bug with multitenancy ?


Could you share complete error log for Sales Invoice doesn’t exist error? Perhaps there is a script in the custom app calling Sales Invoice?

I only have part of the error log that too in the screenshot. I dont know why but I deleted the logs from Error Log list doctype. Let me check in the error log file once and update.

But strange thing is this particular site does not have ERPNext installed at all. So now my doubt is there a parent (Frappe framework level) level script/custom script which runs for all the site?

Traceback (most recent call last):
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/”, line 62, in application
response = frappe.handler.handle()
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/”, line 22, in handle
data = execute_cmd(cmd)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/”, line 53, in execute_cmd
return, **frappe.form_dict)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/”, line 939, in call
return fn(*args, **newargs)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/desk/form/”, line 33, in getdoc
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/desk/form/”, line 202, in run_onload
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/model/”, line 757, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/model/”, line 1026, in composer
return composed(self, method, *args, **kwargs)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/model/”, line 1009, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/model/”, line 751, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/ubuntu/frappe-bench/apps/erpnext/erpnext/setup/doctype/company/”, line 18, in onload
self.get(“__onload”)[“transactions_exist”] = self.check_if_transactions_exist()
File “/home/ubuntu/frappe-bench/apps/erpnext/erpnext/setup/doctype/company/”, line 25, in check_if_transactions_exist
limit 1"“” % (doctype, “%s”),
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/”, line 166, in sql
self._cursor.execute(query, values)
File “/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/”, line 170, in execute
result = self._query(query)
File “/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/”, line 328, in _query
File “/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/”, line 516, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File “/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/”, line 727, in _read_query_result
File “/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/”, line 1066, in read
first_packet = self.connection._read_packet()
File “/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/”, line 683, in _read_packet
File “/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/”, line 220, in check_error
File “/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/”, line 109, in raise_mysql_exception
raise errorclass(errno, errval)
ProgrammingError: (1146, u"Table ‘2f041c57b7cf613b.tabSales Invoice’ doesn’t exist")

Here is the complete error from web.log file. And there is no script in the custom app at least I haven’t created one.