Site migration error V12

Executing frappe.patches.v11_0.make_all_prepared_report_attachments_private #2019-11-26 in site1.local (_1bd3e0294da19198)
Traceback (most recent call last):
File “/home/sanath/frappe-bench/env/lib/python3.5/shutil.py”, line 544, in move
os.rename(src, real_dst)
FileNotFoundError: [Errno 2] No such file or directory: ‘./site1.local/public/files/2019-17-23-12:8.jsone10a7a.gz’ → ‘./site1.local/private/files/2019-17-23-12:8.jsone10a7a.gz’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/sanath/frappe-bench/apps/frappe/frappe/patches/v11_0/make_all_prepared_report_attachments_private.py”, line 16, in execute
file_doc.save()
File “/home/sanath/frappe-bench/apps/frappe/frappe/model/document.py”, line 272, in save
return self._save(*args, **kwargs)
File “/home/sanath/frappe-bench/apps/frappe/frappe/model/document.py”, line 308, in _save
self.run_before_save_methods()
File “/home/sanath/frappe-bench/apps/frappe/frappe/model/document.py”, line 888, in run_before_save_methods
self.run_method(“validate”)
File “/home/sanath/frappe-bench/apps/frappe/frappe/model/document.py”, line 787, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/sanath/frappe-bench/apps/frappe/frappe/model/document.py”, line 1058, in composer
return composed(self, method, *args, **kwargs)
File “/home/sanath/frappe-bench/apps/frappe/frappe/model/document.py”, line 1041, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/sanath/frappe-bench/apps/frappe/frappe/model/document.py”, line 781, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/sanath/frappe-bench/apps/frappe/frappe/core/doctype/file/file.py”, line 118, in validate
os.path.join(private_files, self.file_name))
File “/home/sanath/frappe-bench/env/lib/python3.5/shutil.py”, line 558, in move
copy_function(src, real_dst)
File “/home/sanath/frappe-bench/env/lib/python3.5/shutil.py”, line 257, in copy2
copyfile(src, dst, follow_symlinks=follow_symlinks)
File “/home/sanath/frappe-bench/env/lib/python3.5/shutil.py”, line 120, in copyfile
with open(src, ‘rb’) as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: ‘./site1.local/public/files/2019-17-23-12:8.jsone10a7a.gz’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/lib/python3.5/runpy.py”, line 193, in _run_module_as_main
main”, mod_spec)
File “/usr/lib/python3.5/runpy.py”, line 85, in _run_code
exec(code, run_globals)
File “/home/sanath/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 97, in
main()
File “/home/sanath/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/sanath/frappe-bench/env/lib/python3.5/site-packages/click/core.py”, line 764, in call
return self.main(*args, **kwargs)
File “/home/sanath/frappe-bench/env/lib/python3.5/site-packages/click/core.py”, line 717, in main
rv = self.invoke(ctx)
File “/home/sanath/frappe-bench/env/lib/python3.5/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/sanath/frappe-bench/env/lib/python3.5/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/sanath/frappe-bench/env/lib/python3.5/site-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/sanath/frappe-bench/env/lib/python3.5/site-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/home/sanath/frappe-bench/env/lib/python3.5/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/sanath/frappe-bench/apps/frappe/frappe/commands/init.py”, line 25, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/sanath/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/sanath/frappe-bench/apps/frappe/frappe/migrate.py”, line 49, in migrate
frappe.modules.patch_handler.run_all(skip_failing)
File “/home/sanath/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 41, in run_all
run_patch(patch)
File “/home/sanath/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 30, in run_patch
if not run_single(patchmodule = patch):
File “/home/sanath/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 71, in run_single
return execute_patch(patchmodule, method, methodargs)
File “/home/sanath/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 91, in execute_patch
frappe.get_attr(patchmodule.split()[0] + “.execute”)()
File “/home/sanath/frappe-bench/apps/frappe/frappe/patches/v11_0/make_all_prepared_report_attachments_private.py”, line 19, in execute
frappe.delete_doc(“Prepared Report”, file_dict.attached_to_name)
File “/home/sanath/frappe-bench/apps/frappe/frappe/init.py”, line 782, in delete_doc
ignore_permissions, flags, ignore_on_trash, ignore_missing)
File “/home/sanath/frappe-bench/apps/frappe/frappe/model/delete_doc.py”, line 95, in delete_doc
doc.run_method(“on_trash”)
File “/home/sanath/frappe-bench/apps/frappe/frappe/model/document.py”, line 787, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/sanath/frappe-bench/apps/frappe/frappe/model/document.py”, line 1058, in composer
return composed(self, method, *args, **kwargs)
File “/home/sanath/frappe-bench/apps/frappe/frappe/model/document.py”, line 1041, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/sanath/frappe-bench/apps/frappe/frappe/model/document.py”, line 781, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/sanath/frappe-bench/apps/frappe/frappe/core/doctype/prepared_report/prepared_report.py”, line 28, in on_trash
remove_all(“Prepared Report”, self.name)
File “/home/sanath/frappe-bench/apps/frappe/frappe/core/doctype/file/file.py”, line 745, in remove_all
remove_file(fid=fid, attached_to_doctype=dt, attached_to_name=dn, from_delete=from_delete)
File “/home/sanath/frappe-bench/apps/frappe/frappe/core/doctype/file/file.py”, line 730, in remove_file
comment = doc.add_comment(“Attachment Removed”, (“Removed {0}”).format(file_name))
File “/home/sanath/frappe-bench/apps/frappe/frappe/model/document.py”, line 1134, in add_comment
}).insert(ignore_permissions=True)
File “/home/sanath/frappe-bench/apps/frappe/frappe/model/document.py”, line 244, in insert
self.db_insert()
File “/home/sanath/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 326, in db_insert
), list(d.values()))
File “/home/sanath/frappe-bench/apps/frappe/frappe/database/database.py”, line 125, in sql
self.check_transaction_status(query)
File “/home/sanath/frappe-bench/apps/frappe/frappe/database/database.py”, line 261, in check_transaction_status
frappe.throw(
(“Too many writes in one request. Please send smaller requests”), frappe.ValidationError)
File “/home/sanath/frappe-bench/apps/frappe/frappe/init.py”, line 363, in throw
msgprint(msg, raise_exception=exc, title=title, indicator=‘red’)
File “/home/sanath/frappe-bench/apps/frappe/frappe/init.py”, line 349, in msgprint
_raise_exception()
File “/home/sanath/frappe-bench/apps/frappe/frappe/init.py”, line 315, in _raise_exception
raise raise_exception(msg)
frappe.exceptions.ValidationError: Too many writes in one request. Please send smaller requests
sanath@vmi319960:~/frappe-bench$

sanath@vmi319960:~/frappe-bench$ bench --site site1.local migrate
Migrating site1.local
Executing frappe.patches.v11_0.make_all_prepared_report_attachments_private #2019-11-26 in site1.local (1bd3e0294da19198)

Here the migration get stuck and getting above error after 30 min.

Hi @Sanath_Udayawansa2

Have you restored the DB ? After restoring the DB you done site migrate ?

The error is
FileNotFoundError: [Errno 2] No such file or directory: ‘./site1.local/public/files/2019-17-23-12:8.jsone10a7a.gz’

If you want to resolve this issue immediately to move forward in your task , just create a file which is missing in that path after that do once again site migrate .

1 Like

Have you checked permissions/ownership? Might be that someone ran an update or something as a different user, which is now clashing with your current setup.

cd ~/frappe-bench; 
sudo chown -R sanath:sanath ./*
bench update #or bench update --reset