Bench update 7.2.27 error

I am getting this error when updating by dev environment

Executing execute:frappe.utils.global_search.setup_global_search_table() in erpnext-dev (0acfbbe28584367f)
Traceback (most recent call last):

...

File "/home/erpnext/erpnext-dev/apps/frappe/frappe/modules/utils.py", line 184, in load_doctype_module
    raise ImportError, 'Module import failed for {0} ({1})'.format(doctype, module_name)
ImportError: Module import failed for UserRole (frappe.core.doctype.userrole.userrole)

Any Ideas?

Where you found this? Are you able to replicate this?

I only have the one dev environment, so hard to “duplicate” unless I want to mess up my prod environment. My dev and prod environments are both ERPNext 7.2.18 and Frappe 7.2.14. I was going through my regular monthly update to latest stable starting with my dev environment.

Every time I attempt an update to my dev environment it fails on this step. I have attempted it 3 times so far yesterday.

Executing erpnext.patches.v7_2.arrear_leave_encashment_as_salary_component in erp.local (f96f6049873e6ea7)
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 79, in <module>
    main()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 16, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 24, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/commands/site.py", line 210, in migrate
    migrate(context.verbose, rebuild_website=rebuild_website)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/migrate.py", line 31, in migrate
    frappe.modules.patch_handler.run_all()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 29, in run_all
    if not run_single(patchmodule = patch):
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 63, in run_single
    return execute_patch(patchmodule, method, methodargs)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 83, in execute_patch
    frappe.get_attr(patchmodule.split()[0] + ".execute")()
  File "/home/ubuntu/frappe-bench/apps/erpnext/erpnext/patches/v7_2/arrear_leave_encashment_as_salary_component.py", line 12, in execute
    "salary_component_abbr": salary_abbr
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py", line 190, in insert
    self.validate_higher_perm_levels()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py", line 451, in validate_higher_perm_levels
    has_access_to = self.get_permlevel_access()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py", line 466, in get_permlevel_access
    roles = frappe.get_roles()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/__init__.py", line 362, in get_roles
    return get_user().get_roles()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/__init__.py", line 350, in get_user
    local.user_perms = UserPermissions(local.session.user)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/utils/user.py", line 37, in __init__
    self.setup_user()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/utils/user.py", line 53, in setup_user
    user_doc = frappe.cache().hget("user_doc", self.name, get_user_doc)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/utils/redis_wrapper.py", line 171, in hget
    value = generator()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/utils/user.py", line 43, in get_user_doc
    user = frappe.get_doc("User", self.name).as_dict()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/__init__.py", line 603, in get_doc
    return frappe.model.document.get_doc(arg1, arg2)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py", line 51, in get_doc
    return controller(arg1, arg2)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py", line 84, in __init__
    self.load_from_db()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py", line 130, in load_from_db
    self.set(df.fieldname, children)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/base_document.py", line 122, in set
    self.extend(key, value)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/base_document.py", line 148, in extend
    self.append(key, v)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/base_document.py", line 136, in append
    value = self._init_child(value, key)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/base_document.py", line 163, in _init_child
    value = get_controller(value["doctype"])(value)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/base_document.py", line 34, in get_controller
    module = load_doctype_module(doctype, module_name)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/utils.py", line 184, in load_doctype_module
    raise ImportError, 'Module import failed for {0} ({1})'.format(doctype, module_name)
ImportError: Module import failed for UserRole (frappe.core.doctype.userrole.userrole)

Same issue here.

Interesting, so I am getting same error as you, but from a different function call on the upgrade. For the record, here is the entire stack trace.

Executing execute:frappe.utils.global_search.setup_global_search_table() in erpnext-dev (0acfbbe28584367f)
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/utils/bench_helper.py", line 79, in <module>
    main()
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/utils/bench_helper.py", line 16, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/home/erpnext/erpnext-dev/env/local/lib/python2.7/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/home/erpnext/erpnext-dev/env/local/lib/python2.7/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/home/erpnext/erpnext-dev/env/local/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/erpnext/erpnext-dev/env/local/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/erpnext/erpnext-dev/env/local/lib/python2.7/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/erpnext/erpnext-dev/env/local/lib/python2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/erpnext/erpnext-dev/env/local/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/commands/__init__.py", line 24, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/commands/site.py", line 210, in migrate
    migrate(context.verbose, rebuild_website=rebuild_website)
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/migrate.py", line 30, in migrate
    frappe.modules.patch_handler.run_all()
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/modules/patch_handler.py", line 29, in run_all
    if not run_single(patchmodule = patch):
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/modules/patch_handler.py", line 63, in run_single
    return execute_patch(patchmodule, method, methodargs)
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/modules/patch_handler.py", line 84, in execute_patch
    update_patch_log(patchmodule)
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/modules/patch_handler.py", line 101, in update_patch_log
    frappe.get_doc({"doctype": "Patch Log", "patch": patchmodule}).insert()
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/model/document.py", line 190, in insert
    self.validate_higher_perm_levels()
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/model/document.py", line 451, in validate_higher_perm_levels
    has_access_to = self.get_permlevel_access()
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/model/document.py", line 466, in get_permlevel_access
    roles = frappe.get_roles()
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/__init__.py", line 361, in get_roles
    return get_user().get_roles()
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/__init__.py", line 349, in get_user
    local.user_perms = UserPermissions(local.session.user)
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/utils/user.py", line 37, in __init__
    self.setup_user()
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/utils/user.py", line 53, in setup_user
    user_doc = frappe.cache().hget("user_doc", self.name, get_user_doc)
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/utils/redis_wrapper.py", line 171, in hget
    value = generator()
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/utils/user.py", line 43, in get_user_doc
    user = frappe.get_doc("User", self.name).as_dict()
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/__init__.py", line 602, in get_doc
    return frappe.model.document.get_doc(arg1, arg2)
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/model/document.py", line 51, in get_doc
    return controller(arg1, arg2)
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/model/document.py", line 84, in __init__
    self.load_from_db()
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/model/document.py", line 130, in load_from_db
    self.set(df.fieldname, children)
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/model/base_document.py", line 122, in set
    self.extend(key, value)
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/model/base_document.py", line 148, in extend
    self.append(key, v)
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/model/base_document.py", line 136, in append
    value = self._init_child(value, key)
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/model/base_document.py", line 163, in _init_child
    value = get_controller(value["doctype"])(value)
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/model/base_document.py", line 34, in get_controller
    module = load_doctype_module(doctype, module_name)
  File "/home/erpnext/erpnext-dev/apps/frappe/frappe/modules/utils.py", line 184, in load_doctype_module
    raise ImportError, 'Module import failed for {0} ({1})'.format(doctype, module_name)
ImportError: Module import failed for UserRole (frappe.core.doctype.userrole.userrole)

Pushed a fix, can you try to update again?

Migrating erp.local
Executing erpnext.patches.v7_2.arrear_leave_encashment_as_salary_component in erp.local (f96f6049873e6ea7)
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 79, in <module>
    main()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 16, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 24, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/commands/site.py", line 210, in migrate
    migrate(context.verbose, rebuild_website=rebuild_website)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/migrate.py", line 31, in migrate
    frappe.modules.patch_handler.run_all()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 29, in run_all
    if not run_single(patchmodule = patch):
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 63, in run_single
    return execute_patch(patchmodule, method, methodargs)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 83, in execute_patch
    frappe.get_attr(patchmodule.split()[0] + ".execute")()
  File "/home/ubuntu/frappe-bench/apps/erpnext/erpnext/patches/v7_2/arrear_leave_encashment_as_salary_component.py", line 12, in execute
    "salary_component_abbr": salary_abbr
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py", line 190, in insert
    self.validate_higher_perm_levels()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py", line 451, in validate_higher_perm_levels
    has_access_to = self.get_permlevel_access()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py", line 466, in get_permlevel_access
    roles = frappe.get_roles()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/__init__.py", line 362, in get_roles
    return get_user().get_roles()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/__init__.py", line 350, in get_user
    local.user_perms = UserPermissions(local.session.user)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/utils/user.py", line 37, in __init__
    self.setup_user()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/utils/user.py", line 53, in setup_user
    user_doc = frappe.cache().hget("user_doc", self.name, get_user_doc)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/utils/redis_wrapper.py", line 171, in hget
    value = generator()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/utils/user.py", line 43, in get_user_doc
    user = frappe.get_doc("User", self.name).as_dict()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/__init__.py", line 603, in get_doc
    return frappe.model.document.get_doc(arg1, arg2)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py", line 51, in get_doc
    return controller(arg1, arg2)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py", line 84, in __init__
    self.load_from_db()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py", line 130, in load_from_db
    self.set(df.fieldname, children)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/base_document.py", line 122, in set
    self.extend(key, value)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/base_document.py", line 148, in extend
    self.append(key, v)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/base_document.py", line 136, in append
    value = self._init_child(value, key)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/base_document.py", line 163, in _init_child
    value = get_controller(value["doctype"])(value)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/base_document.py", line 34, in get_controller
    module = load_doctype_module(doctype, module_name)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/utils.py", line 184, in load_doctype_module
    raise ImportError, 'Module import failed for {0} ({1})'.format(doctype, module_name)
ImportError: Module import failed for UserRole (frappe.core.doctype.userrole.userrole)

Unfortunately still the same error.

Is there any chance that you have not pulled latest code of frappe repo? Seems like, the patches from frappe did not run before executing this patch.

I can’t tell exactly. Which patches may I run manually, so it will work?

I was able to get it to work just now. Here are the functions that ran during migration:

Migrating erpnext-dev
Executing execute:frappe.reload_doc('core', 'doctype', 'doctype', force=True) #2017-03-09 in erpnext-dev (0acfbbe28584367f)
Success
Executing frappe.patches.v8_0.drop_in_dialog in erpnext-dev (0acfbbe28584367f)
Success
Executing frappe.patches.v7_2.update_communications in erpnext-dev (0acfbbe28584367f)
Success
Executing frappe.patches.v8_0.update_published_in_global_search in erpnext-dev (0acfbbe28584367f)
Success
Executing erpnext.patches.v7_2.rename_evaluation_criteria in erpnext-dev (0acfbbe28584367f)
Success
Executing erpnext.patches.v7_2.update_party_type in erpnext-dev (0acfbbe28584367f)
Success
Executing erpnext.patches.v7_2.setup_auto_close_settings in erpnext-dev (0acfbbe28584367f)
Success
Executing erpnext.patches.v7_2.empty_supplied_items_for_non_subcontracted in erpnext-dev (0acfbbe28584367f)
Success
Executing erpnext.patches.v7_2.arrear_leave_encashment_as_salary_component in erpnext-dev (0acfbbe28584367f)
Success
Executing erpnext.patches.v7_2.rename_att_date_attendance in erpnext-dev (0acfbbe28584367f)
Success
Executing erpnext.patches.v7_2.update_attendance_docstatus in erpnext-dev (0acfbbe28584367f)
Success
Executing erpnext.patches.v7_2.move_dates_from_salary_structure_to_employee in erpnext-dev (0acfbbe28584367f)
Success
Executing erpnext.patches.v7_2.make_all_assessment_group in erpnext-dev (0acfbbe28584367f)
Success
Executing erpnext.patches.v7_2.stock_uom_in_selling in erpnext-dev (0acfbbe28584367f)
Success

Interesting that there were some 8.0 migration functions in there. My dev is now on v7.2.29 for both ERPNext and Frappe.

Because this is still not working for me, I recovered the database from the last mysqldump I made before trying to do bench update.

The error I get is:

Executing execute:frappe.reload_doc('core', 'doctype', 'doctype', force=True) #2017-03-09 in erp.local (f96f6049873e6ea7)
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 79, in <module>
    main()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 16, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 24, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/commands/site.py", line 210, in migrate
    migrate(context.verbose, rebuild_website=rebuild_website)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/migrate.py", line 31, in migrate
    frappe.modules.patch_handler.run_all()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 29, in run_all
    if not run_single(patchmodule = patch):
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 63, in run_single
    return execute_patch(patchmodule, method, methodargs)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 81, in execute_patch
    exec patchmodule.split("execute:")[1] in globals()
  File "<string>", line 1, in <module>
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/__init__.py", line 660, in reload_doc
    return frappe.modules.reload_doc(module, dt, dn, force=force, reset_permissions=reset_permissions)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/utils.py", line 152, in reload_doc
    return import_files(module, dt, dn, force=force, reset_permissions=reset_permissions)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 19, in import_files
    reset_permissions=reset_permissions)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 24, in import_file
    ret = import_file_by_path(path, force, pre_process=pre_process, reset_permissions=reset_permissions)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 58, in import_file_by_path
    ignore_version=ignore_version, reset_permissions=reset_permissions)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 129, in import_doc
    doc.insert()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py", line 212, in insert
    d.db_insert()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/base_document.py", line 296, in db_insert
    ), d.values())
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/database.py", line 138, in sql
    self._cursor.execute(query, values)
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 205, in execute
    self.errorhandler(self, exc, value)
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
_mysql_exceptions.OperationalError: (1048, "Column 'is_custom' cannot be null")

Any ideas?

Is there any help? I created a new volume from a valid backup (whole snapshot of the working machine), which is working, but impossible to update.

Whatever I try, I can only pass from error to error.

EDIT: I recovered again from backup, switched to master, used the solution in here Switch to master error[SOLVED] - #3 by sp9leo and just left the machine running as master, because this is production environment from now.