After Login Error

After logging in, I’m encountering this error. Please help

cd ~/frappe-bench; bench update

should fix this

Thanks @trentmu but I already updated my bench but the error persists :frowning:

Have you tried clearing cache etc?

Yes, I already did

bench clear-cache
bench restart

Maybe check your log files

Thanks @trentmu for the replies, I already solved this. There is something wrong in my database :smiley:

Would you mind sharing the solution so we can learn from you?


HI @trentmu

In our case, the problem is from the database of Custom DocPerm. When I checked the Apply User Permission in timesheet in Role Permissions Manager, this error will occur. So what we did is, we set it again back to 0 so that it will not be checked :smiley:

This is the complete traceback:

  File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/", line 97, in get_notifications_for_doctypes
    filters=condition, limit_page_length = 100, as_list=True, ignore_ifnull=True))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/", line 1150, in get_list
    return frappe.model.db_query.DatabaseQuery(doctype).execute(None, args, *kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/", line 88, in execute
    result = self.build_and_run()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/", line 100, in build_and_run
    args = self.prepare_args()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/", line 119, in prepare_args
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/", line 293, in build_conditions
    match_conditions = self.build_match_conditions()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/", line 424, in build_match_conditions
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/", line 455, in add_user_permissions
    user_permission_doctypes = frappe.permissions.get_user_permission_doctypes(user_permission_doctypes, user_permissions)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/", line 456, in get_user_permission_doctypes
if len(user_permission_doctypes) > 1:
TypeError: object of type 'NoneType' has no len()```

As you can see, the error is in line 456 of file It has len() method in it.

So we think this is a bug because checking Apply User Permission is part of user activity, this should not return an error.
1 Like

Thank you.