Internal Server Error 500 on ERPNext v16

Hi all,

I am playing around with the new ERPNext v16 Desktop. I removed a few icons from the Desktop Icon list, unchecking them as Standard and checking them as Hidden.

On returning to the Desktop and clearing the cache, I get an Internal Server 500 error that doesn’t resolve unless I reset the entire site. Any ideas why this is happening?

I assume it’s because of unchecking it as Standard, but if so is there a reason it is it an option? The following is the traceback log.

Traceback (most recent call last):
  File "apps/frappe/frappe/www/desk.py", line 30, in get_context
    boot = frappe.sessions.get()
  File "apps/frappe/frappe/sessions.py", line 144, in get
    bootinfo = get_bootinfo()
  File "apps/frappe/frappe/boot.py", line 60, in get_bootinfo
    bootinfo.desktop_icons = get_desktop_icons(bootinfo=bootinfo)
                             ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/desk/doctype/desktop_icon/desktop_icon.py", line 234, in get_desktop_icons
    icon = frappe.get_doc("Desktop Icon", s)
  File "apps/frappe/frappe/model/utils/__init__.py", line 218, in wrapper
    return dispatch(args[0])(*args, **kw)
           ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 125, in get_doc_str
    doc = controller(doctype, name, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 208, in __init__
    self.load_from_db()
    ~~~~~~~~~~~~~~~~~^^
  File "apps/frappe/frappe/model/document.py", line 276, in load_from_db
    frappe.throw(
    ~~~~~~~~~~~~^
    	_("{0} {1} not found").format(_(self.doctype), self.name),
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    	frappe.DoesNotExistError(doctype=self.doctype),
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "apps/frappe/frappe/utils/messages.py", line 148, in throw
    msgprint(
    ~~~~~~~~^
    	msg,
     ^^^^
    ...<6 lines>...
    	primary_action=primary_action,
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "apps/frappe/frappe/utils/messages.py", line 109, in msgprint
    _raise_exception()
    ~~~~~~~~~~~~~~~~^^
  File "apps/frappe/frappe/utils/messages.py", line 58, in _raise_exception
    raise exc
frappe.exceptions.DoesNotExistError: Desktop Icon {'label': 'Build', 'link': None, 'link_type': 'Workspace Sidebar', 'app': 'erpnext', 'icon_type': 'Link', 'parent_icon': 'ERPNext', 'icon': 'hammer', 'link_to': 'Selling', 'idx': 1, 'standard': 0, 'logo_url': None, 'hidden': 0, 'name': 'Selling', 'sidebar': None} not found

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

Traceback (most recent call last):
  File "apps/frappe/frappe/website/serve.py", line 20, in get_response
    return renderer_instance.render()
           ~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "apps/frappe/frappe/website/page_renderers/template_page.py", line 84, in render
    html = self.get_html()
  File "apps/frappe/frappe/website/utils.py", line 540, in cache_html_decorator
    html = func(*args, **kwargs)
  File "apps/frappe/frappe/website/page_renderers/template_page.py", line 95, in get_html
    self.update_context()
    ~~~~~~~~~~~~~~~~~~~^^
  File "apps/frappe/frappe/website/page_renderers/template_page.py", line 163, in update_context
    data = self.run_pymodule_method("get_context")
  File "apps/frappe/frappe/website/page_renderers/template_page.py", line 223, in run_pymodule_method
    return method(self.context)
  File "apps/frappe/frappe/www/desk.py", line 32, in get_context
    raise frappe.SessionBootFailed from e
frappe.exceptions.SessionBootFailed

Thanks everyone!

bench migrate
or check your custom app icon in hooks.py

Do you have CRM app installed along with ERPNext on version 16?

if you can play with codes you can use other answers. If you are No-coder like me first you should join with Adminstration user (not any admin user only Adminstration)

Then go to this page:
your_site.com/desk/desktop-icon

When you open desktop icon doctype then follow this method:

It will work.

1 Like

I do not

Will attempt this when making icons, thank you. The issues seems to also occur when creating new icons and trying to link them, so maybe it’s not related to the unchecking Standard as I initially thought.

Didn’t see your comment about unchecking Standart checkbox, sorry.
Yes when you create new icon you should check standart and select an app for it.
As you said I am not sure why it’s an option if we can’t uncheck it.
And what is the function of the roles section? Not a clue

1 Like

This error is not related to your OFC MTTR script :+1:
It’s a Desk boot failure caused by a broken Desktop Icon record.

Let’s break it down cleanly and fix it safely.

frappe.exceptions.DoesNotExistError:
Desktop Icon {… ‘name’: ‘Selling’} not found

During login / desk load, Frappe tries to load Desktop Icons and crashes because:

  • A Desktop Icon record exists

  • But it points to something that does not exist anymore

  • Specifically: Selling workspace / icon

So Desk cannot boot → SessionBootFailed

Root Cause (99% Cases)

One of these happened:

  1. Selling workspace deleted or renamed

  2. Desktop Icon record left behind (or corrupted)

  3. Custom app / migration partially removed ERPNext icons

  4. Manual DB changes / patch failure

  5. ERPNext upgrade didn’t clean old Desktop Icon data

Root Cause (99% Cases)

One of these happened:

  1. Selling workspace deleted or renamed

  2. Desktop Icon record left behind (or corrupted)

  3. Custom app / migration partially removed ERPNext icons

  4. Manual DB changes / patch failure

  5. ERPNext upgrade didn’t clean old Desktop Icon data

FIX (SAFE & RECOMMENDED)

:wrench: Option 1: Delete Broken Desktop Icon (FASTEST)

Run this in System Console (or bench console):

frappe.db.delete("Desktop Icon", {
    "name": "Selling"
})

frappe.db.commit()

Then hard refresh browser or restart bench.

Option 2: Clean All Broken Desktop Icons (BEST PRACTICE)

Run this to remove any icon pointing to missing workspace/module:

icons = frappe.get_all(
    "Desktop Icon",
    fields=["name", "link_to", "link_type"]
)

for i in icons:
    if i.link_type == "Workspace Sidebar" and i.link_to:
        if not frappe.db.exists("Workspace", i.link_to):
            frappe.delete_doc("Desktop Icon", i.name, force=1)

frappe.db.commit()

:check_mark: Cleans all invalid icons
:check_mark: Safe for production
:check_mark: No data loss (icons regenerate)