Error while updating bench

Hi All,

I need help. While upgrading today, I got this error, and I don’t know what to do!

Migrating site2.local
Executing frappe.patches.v6_1.rename_file_data in site2.local (site2.local)
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
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 610, in call
return self.main(*args, **kwargs)
File “/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 590, in main
rv = self.invoke(ctx)
File “/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 936, 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 936, 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 782, 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 416, in invoke
return callback(*args, **kwargs)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/commands.py”, line 29, in _func
ret = f(frappe.dict(ctx.obj), *args, **kwargs)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/commands.py”, line 214, in migrate
frappe.modules.patch_handler.run_all()
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 25, in run_all
if not run_single(patchmodule = patch):
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 52, in run_single
return execute_patch(patchmodule, method, methodargs)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 74, in execute_patch
frappe.db.rollback()
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/database.py”, line 683, in rollback
obj.on_rollback()
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/core/doctype/file/file.py”, line 221, in on_rollback
self.on_trash()
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/core/doctype/file/file.py”, line 131, in on_trash
frappe.throw(
(“Cannot delete Home and Attachments folders”))
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/init.py”, line 257, in throw
msgprint(msg, raise_exception=exc)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/init.py”, line 250, in msgprint
_raise_exception()
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/init.py”, line 235, in _raise_exception
raise raise_exception, encode(msg)
frappe.exceptions.ValidationError: Cannot delete Home and Attachments folders
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 9, in
load_entry_point(‘bench==0.1’, ‘console_scripts’, ‘bench’)()
File “/home/ubuntu/bench-repo/bench/cli.py”, line 60, in cli
bench()
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 610, in call
return self.main(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 590, in main
rv = self.invoke(ctx)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 936, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 782, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 416, in invoke
return callback(*args, **kwargs)
File “/home/ubuntu/bench-repo/bench/cli.py”, line 240, in _update
update(pull, patch, build, bench, auto, restart_supervisor, requirements, no_backup, upgrade, force=force)
File “/home/ubuntu/bench-repo/bench/cli.py”, line 273, in update
patch_sites(bench=bench_path)
File “/home/ubuntu/bench-repo/bench/utils.py”, line 157, in patch_sites
run_frappe_cmd(‘–site’, ‘all’, ‘migrate’, bench=bench)
File “/home/ubuntu/bench-repo/bench/utils.py”, line 488, in run_frappe_cmd
raise CommandFailedError(args)
bench.utils.CommandFailedError: (‘–site’, ‘all’, ‘migrate’)

this patch failed to execute, may be someone from community helps you

@ahmed seems you are re-running the patch? This error should not have come.

@rmehta I am only doing “bench update” and the error is coming. Is there a way to continue the update without running this patch ?

Did you upload File table.

You can comment the patch by adding a return statement in the patch file in the execute method.

@rmehta,

I am not sure I am following you. I only did (and can do) “bench update”
Is there a simple way to do what you mentioned ?

Regards,
Ahmed

I am not sure, but your patch broke for some reason. Either you had a partially broken site or you had some local changes I am not sure. But you will have ot bypass the patch by opening the file or ask for help from a freelancer.