Try ERPNext Buy Support Partners Foundation

"Hidden Modules" error in bench update

While doing bench update i get the following problem -

bench update
INFO:bench.utils:updating bench
INFO:bench.utils:git pull
Already up to date.
INFO:bench.utils:./env/bin/pip install Pillow
Requirement already satisfied: Pillow in ./env/lib/python3.6/site-packages (6.2.1)
Backing up sites...


Cannot proceed with update: You have local changes in app "frappe" that are not committed.

Here are your choices:

1. Merge the frappe app manually with "git pull" / "git pull --rebase" and fix conflicts.
1. Temporarily remove your changes with "git stash" or discard them completely
	with "bench update --reset" or for individual repositries "git reset --hard"
2. If your changes are helpful for others, send in a pull request via GitHub and
	wait for them to be merged in the core.

After trying bench update --reset i get the following -

bench update --reset
INFO:bench.utils:updating bench
INFO:bench.utils:git pull
Already up to date.
INFO:bench.utils:./env/bin/pip install Pillow
Requirement already satisfied: Pillow in ./env/lib/python3.6/site-packages (6.2.1)
Backing up sites...
INFO:bench.app:pulling frappe
INFO:bench.utils:git fetch --all
Fetching upstream
INFO:bench.utils:git reset --hard upstream/develop
HEAD is now at 2071d8108 Merge pull request #9046 from prssanna/new-doc-fix
INFO:bench.utils:find . -name "*.pyc" -delete
INFO:bench.app:pulling erpnext
INFO:bench.utils:git fetch --all
Fetching upstream
INFO:bench.utils:git reset --hard upstream/develop
HEAD is now at 741f64a51d Merge pull request #19960 from rohitwaghchaure/fixed_incorrect_child_bom_fecthed_develop
INFO:bench.utils:find . -name "*.pyc" -delete
Updating Python libraries...
INFO:bench.utils:./env/bin/pip install -q -U pip
INFO:bench.utils:/usr/local/bin/pip3 install --user -q -U -r /home/frappe/.bench/requirements.txt
INFO:bench.app:installing frappe
INFO:bench.utils:./env/bin/pip install -q -U -e ./apps/frappe 
INFO:bench.app:installing erpnext
INFO:bench.utils:./env/bin/pip install -q -U -e ./apps/erpnext 
Updating node packages...
INFO:bench.utils:yarn install
yarn install v1.19.1
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.24s.
INFO:bench.utils:yarn install
yarn install v1.19.1
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.59s.
Patching sites...
Migrating erp.blueprogear.com
Executing frappe.patches.v12_0.fix_home_settings_for_all_users in erp.blueprogear.com (_1bd3e0294da19198)
Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 97, in <module>
    main()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 18, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 25, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py", line 235, in migrate
    migrate(context.verbose, rebuild_website=rebuild_website, skip_failing=skip_failing)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py", line 49, in migrate
    frappe.modules.patch_handler.run_all(skip_failing)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 41, in run_all
    run_patch(patch)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 30, in run_patch
    if not run_single(patchmodule = patch):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 71, in run_single
    return execute_patch(patchmodule, method, methodargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 91, in execute_patch
    frappe.get_attr(patchmodule.split()[0] + ".execute")()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/patches/v12_0/fix_home_settings_for_all_users.py", line 28, in execute
    hidden_modules = home_settings['hidden_modules']
KeyError: 'hidden_modules'

Please Note: I’ve already tried the git stash, pull and reset method as described in this link.

Please do help.

Thanks,
Parth.

I am also getting the same issue. Any solution yet?

Here is the link to my issue - Error on update - home_settings

Need Solution on this, System stuck on this

Same here now…!! I even set maintenance_mode = o in common site config file and even in the site_config.json but still the same.

You can try to skip this patch.

Open database (bench mariadb)
Then execute this statement:

INSERT INTO `tabPatch Log` (`name`, `creation`, `modified`, `modified_by`, `owner`, `docstatus`, `idx`, `patch`) VALUES ('Custompatch-1', '2019-12-17 12:55:41.259451', '2019-12-17 12:55:41.259451', 'Administrator', 'Administrator', '0', '0', 'frappe.patches.v12_0.fix_home_settings_for_all_users');

If you have multiple sites, then this step has do be done for each site.

After that, bench update --reset

However, create a backup before executing this statement, as it could break something.

Edit: What does this do? When bench update is executed, it will exclude this specific patch (Fix home settings for all users) because the system thinks that this update is already installed. If you solely updated to get this patch, then this solution will be useless for you.

Thank you so much for the help. I will remember this solution for my future updates. This is a quick hack… However, I need the bug fix…

Since ERPNext v12, patches tend to fail if the system language is not english. You could try to change your system language to english and then update again