Upgrade from v15.38.0 to v15.63.1 fails: No module named 'frappe.core.doctype.workspace_settings'

This error is the same as Error: No module named ‘frappe.core.doctype.workspace_settings’ but the cause is not.

It seems I got very unlucky: this deployment of Frappe/ERPNext (v15.38.0/v15.33.2 respectively) happened to include a PR that got reverted very shortly after it made it to the version-15 branch. This added the Workspace Settings doctype and removed it. Everything seems to work otherwise, it’s just the error message on first page load that I can’t make go away.

How do I resolve this properly in a production environment?

Git blame:
History for frappe/frappe/desk/doctype/workspace_settings/ on version-15

Thanks

Traceback:

App Versions

{
	"erpnext": "15.56.0",
	"frappe": "15.63.1",
	"hrms": "15.42.2",
	"payments": "0.0.1",
	"uk_vat": "0.0.1"
}

Route

Workspaces/Home

Traceback

Traceback (most recent call last):
  File "apps/frappe/frappe/modules/utils.py", line 254, in load_doctype_module
    doctype_python_modules[key] = frappe.get_module(module_name)
  File "apps/frappe/frappe/__init__.py", line 1436, in get_module
    return importlib.import_module(modulename)
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'frappe.core.doctype.workspace_settings'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 115, in application
    response = frappe.api.handle(request)
  File "apps/frappe/frappe/api/__init__.py", line 49, in handle
    data = endpoint(**arguments)
  File "apps/frappe/frappe/api/v1.py", line 36, in handle_rpc_call
    return frappe.handler.handle()
  File "apps/frappe/frappe/handler.py", line 51, in handle
    data = execute_cmd(cmd)
  File "apps/frappe/frappe/handler.py", line 84, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "apps/frappe/frappe/__init__.py", line 1736, in call
    return fn(*args, **newargs)
  File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
  File "apps/frappe/frappe/client.py", line 86, in get
    doc = frappe.get_doc(doctype, name)
  File "apps/frappe/frappe/__init__.py", line 1299, in get_doc
    return frappe.model.document.get_doc(*args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 83, in get_doc
    controller = get_controller(doctype)
  File "apps/frappe/frappe/model/base_document.py", line 71, in get_controller
    site_controllers[doctype] = import_controller(doctype)
  File "apps/frappe/frappe/model/base_document.py", line 96, in import_controller
    module = load_doctype_module(doctype, module_name)
  File "apps/frappe/frappe/modules/utils.py", line 258, in load_doctype_module
    raise ImportError(msg) from e
ImportError: Module import failed for Workspace Settings, the DocType you're trying to open might be deleted.
Error: No module named 'frappe.core.doctype.workspace_settings'

Request Data

{
	"type": "GET",
	"args": {
		"doctype": "Workspace Settings",
		"name": "Workspace Settings"
	},
	"headers": {},
	"error_handlers": {},
	"url": "/api/method/frappe.client.get",
	"request_id": null
}

Response Data

{
	"exception": "Error: No module named 'frappe.core.doctype.workspace_settings'",
	"exc_type": "ImportError"
}

Hi,

May we know the hosting environment and how the upgrade was performed?