Error on Bench Update Unknown column 'default_app

Installed apps :

Frappe Framework: v15.36.0 (version-15)

Frappe LMS: v2.0.0 (develop)

Traceback :

Traceback (most recent call last):
File “/home/lms/lms/apps/frappe/frappe/website/serve.py”, line 20, in get_response
response = renderer_instance.render()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/website/page_renderers/template_page.py”, line 84, in render
html = self.get_html()
^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/website/utils.py”, line 529, in cache_html_decorator
html = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/website/page_renderers/template_page.py”, line 92, in get_html
self.init_context()
File “/home/lms/lms/apps/frappe/frappe/website/page_renderers/base_template_page.py”, line 15, in init_context
self.context.update(get_website_settings())
^^^^^^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/website/doctype/website_settings/website_settings.py”, line 263, in get_website_settings
context.boot = get_boot_data()
^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/website/utils.py”, line 174, in get_boot_data
“default_path”: get_default_path() or “”,
^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/apps.py”, line 59, in get_default_path
user_default_app = frappe.db.get_value(“User”, frappe.session.user, “default_app”)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/database/database.py”, line 512, in get_value
result = self.get_values(
^^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/database/database.py”, line 616, in get_values
out = self._get_values_from_table(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/database/database.py”, line 889, in _get_values_from_table
return query.run(as_dict=as_dict, debug=debug, update=update, run=run, pluck=pluck)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/query_builder/utils.py”, line 87, in execute_query
result = frappe.db.sql(query, params, *args, **kwargs) # nosemgrep
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/database/database.py”, line 227, in sql
self._cursor.execute(query, values)
File “/home/lms/lms/env/lib/python3.12/site-packages/pymysql/cursors.py”, line 153, in execute
result = self._query(query)
^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/env/lib/python3.12/site-packages/pymysql/cursors.py”, line 322, in _query
conn.query(q)
File “/home/lms/lms/env/lib/python3.12/site-packages/pymysql/connections.py”, line 563, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/env/lib/python3.12/site-packages/pymysql/connections.py”, line 825, in _read_query_result
result.read()
File “/home/lms/lms/env/lib/python3.12/site-packages/pymysql/connections.py”, line 1199, in read
first_packet = self.connection._read_packet()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/env/lib/python3.12/site-packages/pymysql/connections.py”, line 775, in _read_packet
packet.raise_for_error()
File “/home/lms/lms/env/lib/python3.12/site-packages/pymysql/protocol.py”, line 219, in raise_for_error
err.raise_mysql_exception(self._data)
File “/home/lms/lms/env/lib/python3.12/site-packages/pymysql/err.py”, line 150, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.OperationalError: (1054, “Unknown column ‘default_app’ in ‘field list’”)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/lms/lms/apps/frappe/frappe/app.py”, line 123, in application
response = get_response()
^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/website/serve.py”, line 28, in get_response
response = ErrorPage(exception=e).render()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/website/page_renderers/template_page.py”, line 84, in render
html = self.get_html()
^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/website/utils.py”, line 529, in cache_html_decorator
html = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/website/page_renderers/template_page.py”, line 92, in get_html
self.init_context()
File “/home/lms/lms/apps/frappe/frappe/website/page_renderers/error_page.py”, line 14, in init_context
super().init_context()
File “/home/lms/lms/apps/frappe/frappe/website/page_renderers/base_template_page.py”, line 15, in init_context
self.context.update(get_website_settings())
^^^^^^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/website/doctype/website_settings/website_settings.py”, line 263, in get_website_settings
context.boot = get_boot_data()
^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/website/utils.py”, line 174, in get_boot_data
“default_path”: get_default_path() or “”,
^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/apps.py”, line 59, in get_default_path
user_default_app = frappe.db.get_value(“User”, frappe.session.user, “default_app”)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/database/database.py”, line 512, in get_value
result = self.get_values(
^^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/database/database.py”, line 616, in get_values
out = self._get_values_from_table(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/database/database.py”, line 889, in _get_values_from_table
return query.run(as_dict=as_dict, debug=debug, update=update, run=run, pluck=pluck)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/query_builder/utils.py”, line 87, in execute_query
result = frappe.db.sql(query, params, *args, **kwargs) # nosemgrep
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/database/database.py”, line 227, in sql
self._cursor.execute(query, values)
File “/home/lms/lms/env/lib/python3.12/site-packages/pymysql/cursors.py”, line 153, in execute
result = self._query(query)
^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/env/lib/python3.12/site-packages/pymysql/cursors.py”, line 322, in _query
conn.query(q)
File “/home/lms/lms/env/lib/python3.12/site-packages/pymysql/connections.py”, line 563, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/env/lib/python3.12/site-packages/pymysql/connections.py”, line 825, in _read_query_result
result.read()
File “/home/lms/lms/env/lib/python3.12/site-packages/pymysql/connections.py”, line 1199, in read
first_packet = self.connection._read_packet()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/env/lib/python3.12/site-packages/pymysql/connections.py”, line 775, in _read_packet
packet.raise_for_error()
File “/home/lms/lms/env/lib/python3.12/site-packages/pymysql/protocol.py”, line 219, in raise_for_error
err.raise_mysql_exception(self._data)
File “/home/lms/lms/env/lib/python3.12/site-packages/pymysql/err.py”, line 150, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.OperationalError: (1054, “Unknown column ‘default_app’ in ‘field list’”)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/lms/lms/apps/frappe/frappe/website/serve.py”, line 20, in get_response
response = renderer_instance.render()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/website/page_renderers/template_page.py”, line 84, in render
html = self.get_html()
^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/website/utils.py”, line 529, in cache_html_decorator
html = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/website/page_renderers/template_page.py”, line 92, in get_html
self.init_context()
File “/home/lms/lms/apps/frappe/frappe/website/page_renderers/base_template_page.py”, line 15, in init_context
self.context.update(get_website_settings())
^^^^^^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/website/doctype/website_settings/website_settings.py”, line 263, in get_website_settings
context.boot = get_boot_data()
^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/website/utils.py”, line 174, in get_boot_data
“default_path”: get_default_path() or “”,
^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/apps.py”, line 59, in get_default_path
user_default_app = frappe.db.get_value(“User”, frappe.session.user, “default_app”)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/database/database.py”, line 512, in get_value
result = self.get_values(
^^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/database/database.py”, line 616, in get_values
out = self._get_values_from_table(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/database/database.py”, line 889, in _get_values_from_table
return query.run(as_dict=as_dict, debug=debug, update=update, run=run, pluck=pluck)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/query_builder/utils.py”, line 87, in execute_query
result = frappe.db.sql(query, params, *args, **kwargs) # nosemgrep
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/database/database.py”, line 227, in sql
self._cursor.execute(query, values)
File “/home/lms/lms/env/lib/python3.12/site-packages/pymysql/cursors.py”, line 153, in execute
result = self._query(query)
^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/env/lib/python3.12/site-packages/pymysql/cursors.py”, line 322, in _query
conn.query(q)
File “/home/lms/lms/env/lib/python3.12/site-packages/pymysql/connections.py”, line 563, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/env/lib/python3.12/site-packages/pymysql/connections.py”, line 825, in _read_query_result
result.read()
File “/home/lms/lms/env/lib/python3.12/site-packages/pymysql/connections.py”, line 1199, in read
first_packet = self.connection._read_packet()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/env/lib/python3.12/site-packages/pymysql/connections.py”, line 775, in _read_packet
packet.raise_for_error()
File “/home/lms/lms/env/lib/python3.12/site-packages/pymysql/protocol.py”, line 219, in raise_for_error
err.raise_mysql_exception(self._data)
File “/home/lms/lms/env/lib/python3.12/site-packages/pymysql/err.py”, line 150, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.OperationalError: (1054, “Unknown column ‘default_app’ in ‘field list’”)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/lms/lms/apps/frappe/frappe/middlewares.py”, line 16, in call
return super().call(environ, start_response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/env/lib/python3.12/site-packages/werkzeug/middleware/shared_data.py”, line 249, in call
return self.app(environ, start_response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/env/lib/python3.12/site-packages/werkzeug/middleware/shared_data.py”, line 249, in call
return self.app(environ, start_response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/app.py”, line 79, in application
app(environ, start_response),
File “/home/lms/lms/env/lib/python3.12/site-packages/werkzeug/wrappers/request.py”, line 190, in application
resp = f(*args[:-2] + (request,))
^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/app.py”, line 132, in application
response = handle_exception(e)
^^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/app.py”, line 395, in handle_exception
response = get_response(“message”, http_status_code=http_status_code)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/website/serve.py”, line 28, in get_response
response = ErrorPage(exception=e).render()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/website/page_renderers/template_page.py”, line 84, in render
html = self.get_html()
^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/website/utils.py”, line 529, in cache_html_decorator
html = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/website/page_renderers/template_page.py”, line 92, in get_html
self.init_context()
File “/home/lms/lms/apps/frappe/frappe/website/page_renderers/error_page.py”, line 14, in init_context
super().init_context()
File “/home/lms/lms/apps/frappe/frappe/website/page_renderers/base_template_page.py”, line 15, in init_context
self.context.update(get_website_settings())
^^^^^^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/website/doctype/website_settings/website_settings.py”, line 263, in get_website_settings
context.boot = get_boot_data()
^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/website/utils.py”, line 174, in get_boot_data
“default_path”: get_default_path() or “”,
^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/apps.py”, line 59, in get_default_path
user_default_app = frappe.db.get_value(“User”, frappe.session.user, “default_app”)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/database/database.py”, line 512, in get_value
result = self.get_values(
^^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/database/database.py”, line 616, in get_values
out = self._get_values_from_table(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/database/database.py”, line 889, in _get_values_from_table
return query.run(as_dict=as_dict, debug=debug, update=update, run=run, pluck=pluck)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/query_builder/utils.py”, line 87, in execute_query
result = frappe.db.sql(query, params, *args, **kwargs) # nosemgrep
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/apps/frappe/frappe/database/database.py”, line 227, in sql
self._cursor.execute(query, values)
File “/home/lms/lms/env/lib/python3.12/site-packages/pymysql/cursors.py”, line 153, in execute
result = self._query(query)
^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/env/lib/python3.12/site-packages/pymysql/cursors.py”, line 322, in _query
conn.query(q)
File “/home/lms/lms/env/lib/python3.12/site-packages/pymysql/connections.py”, line 563, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/env/lib/python3.12/site-packages/pymysql/connections.py”, line 825, in _read_query_result
result.read()
File “/home/lms/lms/env/lib/python3.12/site-packages/pymysql/connections.py”, line 1199, in read
first_packet = self.connection._read_packet()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/lms/lms/env/lib/python3.12/site-packages/pymysql/connections.py”, line 775, in _read_packet
packet.raise_for_error()
File “/home/lms/lms/env/lib/python3.12/site-packages/pymysql/protocol.py”, line 219, in raise_for_error
err.raise_mysql_exception(self._data)
File “/home/lms/lms/env/lib/python3.12/site-packages/pymysql/err.py”, line 150, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.OperationalError: (1054, “Unknown column ‘default_app’ in ‘field list’”)

Stop bench, or restart the bench and migrate site.

already tried that but that didnt work

also i have restored the server and tried bench update again but still same issue

i think the error might be, the update is creating new field definition in json but the same field is not creating in database