Error after Bench Update - Error msg attached

After bench update, getting following error when accessing site.

Traceback (most recent call last):
File “/Users/ibnhaitham/frappe-bench/apps/frappe/frappe/middlewares.py”, line 15, in call
return super(StaticDataMiddleware, self).call(environ, start_response)
File “/Users/ibnhaitham/frappe-bench/env/lib/python2.7/site-packages/werkzeug/wsgi.py”, line 591, in call
return self.app(environ, start_response)
File “/Users/ibnhaitham/frappe-bench/env/lib/python2.7/site-packages/werkzeug/wsgi.py”, line 591, in call
return self.app(environ, start_response)
File “/Users/ibnhaitham/frappe-bench/env/lib/python2.7/site-packages/werkzeug/local.py”, line 224, in application
return ClosingIterator(app(environ, start_response), self.cleanup)
File “/Users/ibnhaitham/frappe-bench/env/lib/python2.7/site-packages/werkzeug/wrappers.py”, line 290, in application
return f(*args[:-2] + (request,))(*args[-2:])
File “/Users/ibnhaitham/frappe-bench/apps/frappe/frappe/app.py”, line 82, in application
response = handle_exception(e)
File “/Users/ibnhaitham/frappe-bench/apps/frappe/frappe/app.py”, line 146, in handle_exception
response = frappe.website.render.render(“message”, http_status_code=http_status_code)
File “/Users/ibnhaitham/frappe-bench/apps/frappe/frappe/website/render.py”, line 55, in render
data = render_page(path)
File “/Users/ibnhaitham/frappe-bench/apps/frappe/frappe/website/render.py”, line 107, in render_page
return build(path)
File “/Users/ibnhaitham/frappe-bench/apps/frappe/frappe/website/render.py”, line 114, in build
return build_page(path)
File “/Users/ibnhaitham/frappe-bench/apps/frappe/frappe/website/render.py”, line 128, in build_page
html = frappe.get_template(context.template).render(context)
File “/Users/ibnhaitham/frappe-bench/env/lib/python2.7/site-packages/jinja2/environment.py”, line 989, in render
return self.environment.handle_exception(exc_info, True)
File “/Users/ibnhaitham/frappe-bench/env/lib/python2.7/site-packages/jinja2/environment.py”, line 754, in handle_exception
reraise(exc_type, exc_value, tb)
File “/Users/ibnhaitham/frappe-bench/apps/frappe/frappe/templates/pages/error.html”, line 1, in top-level template code
{% extends “templates/web.html” %}
File “/Users/ibnhaitham/frappe-bench/apps/frappe/frappe/templates/web.html”, line 1, in top-level template code
{% extends base_template_path %}
File “/Users/ibnhaitham/frappe-bench/apps/frappe_theme/frappe_theme/templates/base.html”, line 1, in top-level template code
{% extends “frappe/templates/base.html” %}
File “/Users/ibnhaitham/frappe-bench/apps/frappe/frappe/templates/base.html”, line 18, in top-level template code
{%- block head -%}
File “/Users/ibnhaitham/frappe-bench/apps/frappe/frappe/templates/base.html”, line 31, in block “head”
{%- block head_include %}{{ head_include or “” }}{% endblock -%}
File “/Users/ibnhaitham/frappe-bench/apps/frappe_theme/frappe_theme/templates/base.html”, line 11, in block “head_include”
{% include “templates/includes/custom.css” %}
File “/Users/ibnhaitham/frappe-bench/env/lib/python2.7/site-packages/jinja2/loaders.py”, line 399, in get_source
raise TemplateNotFound(template)
TemplateNotFound: templates/includes/custom.css

@haitham you seem to have installed an app that looks for custom.css? Have you installed frappe_theme app?

yes. frappe theme app is installed.

please help to get this account started again.

For now either remove frappe_theme app or add custom.css in apps that are installed along with frappe_theme

You can remove an app by running

bench --site SITE uninstall-app APP_NAME

Thanks for help. When doing uninstall app, get following error message.

Traceback (most recent call last):
File “/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py”, line 162, in _run_module_as_main
main”, fname, loader, pkg_name)
File “/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py”, line 72, in _run_code
exec code in run_globals
File “/Users/umairsayyed/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 79, in
main()
File “/Users/umairsayyed/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 16, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/Users/umairsayyed/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 664, in call
return self.main(*args, **kwargs)
File “/Users/umairsayyed/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 644, in main
rv = self.invoke(ctx)
File “/Users/umairsayyed/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 991, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/Users/umairsayyed/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 991, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/Users/umairsayyed/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 837, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/Users/umairsayyed/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 464, in invoke
return callback(*args, **kwargs)
File “/Users/umairsayyed/frappe-bench/apps/frappe/frappe/commands.py”, line 29, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/Users/umairsayyed/frappe-bench/apps/frappe/frappe/commands.py”, line 956, in uninstall
remove_app(app, dry_run)
File “/Users/umairsayyed/frappe-bench/apps/frappe/frappe/installer.py”, line 185, in remove_app
frappe.delete_doc(“Module Def”, module_name)
File “/Users/umairsayyed/frappe-bench/apps/frappe/frappe/init.py”, line 566, in delete_doc
ignore_permissions, flags)
File “/Users/umairsayyed/frappe-bench/apps/frappe/frappe/model/delete_doc.py”, line 79, in delete_doc
check_if_doc_is_linked(doc)
File “/Users/umairsayyed/frappe-bench/apps/frappe/frappe/model/delete_doc.py”, line 159, in check_if_doc_is_linked
frappe.LinkExistsError)
File “/Users/umairsayyed/frappe-bench/apps/frappe/frappe/init.py”, line 262, in throw
msgprint(msg, raise_exception=exc)
File “/Users/umairsayyed/frappe-bench/apps/frappe/frappe/init.py”, line 255, in msgprint
_raise_exception()
File “/Users/umairsayyed/frappe-bench/apps/frappe/frappe/init.py”, line 240, in _raise_exception
raise raise_exception, encode(msg)
frappe.exceptions.LinkExistsError: Cannot delete or cancel because Module Def Accounts is linked with Page Accounts Browser

It started fine by stating below messages, and then error came.

Backing up…
removing Sales Invoice…
removing Purchase Invoice…
removing Journal Entry…
removing C-Form…
removing Monthly Distribution…
removing Payment Request…
removing Sales Taxes and Charges…
removing Purchase Taxes and Charges…
removing Purchase Invoice Item…
removing Bank Reconciliation Detail…

Well are you removing “ERPNext”? If yes then this is a valid error.

Yes. removing “erpnext”.

Does this site have any data? If NOT, then this is the easiest way to go:

Take backup
bench --site SITE backup

Run this for all apps you want to remove:
bench --site SITE remove-from-installed-apps APP_NAME

Then reinstall the site
bench --site SITE reinstall