Migration Error in patches (v6)

I am having the next error when I try to type de migrate command: bench --site name migrate
how I can fix it ?

Executing execute:frappe.delete_doc_if_exists(“DocType”, “Manage Variants Item”) in cmoll (cmoll)
Executing erpnext.patches.v5_8.update_order_reference_in_return_entries in cmoll (cmoll)
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/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 79, in
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 16, in main
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 700, in call
return self.main(*args, **kwargs)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 680, in main
rv = self.invoke(ctx)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1027, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1027, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 873, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 508, in invoke
return callback(*args, **kwargs)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py”, line 16, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands.py”, line 29, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands.py”, line 214, in migrate
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 25, in run_all
if not run_single(patchmodule = patch):
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 52, in run_single
return execute_patch(patchmodule, method, methodargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 68, in execute_patch
frappe.get_attr(patchmodule.split()[0] + “.execute”)()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/patches/v5_8/update_order_reference_in_return_entries.py”, line 8, in execute
frappe.reload_doctype(“Delivery Note”)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 559, in reload_doctype
reload_doc(scrub(db.get_value(“DocType”, doctype, “module”)), “doctype”, scrub(doctype), force=force)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 571, in reload_doc
return frappe.modules.reload_doc(module, dt, dn, force=force)
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/init.py”, line 37, in reload_doc
return import_files(module, dt, dn, force=force)
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 17, in import_files
return import_file(module, dt, dn, force=force, pre_process=pre_process)
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 22, in import_file
ret = import_file_by_path(path, force, pre_process=pre_process)
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 54, in import_file_by_path
import_doc(doc, force=force, data_import=data_import, pre_process=pre_process)
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 122, in import_doc
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 210, in insert
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 605, in run_post_save_methods
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 549, in run_method
return Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 681, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 664, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 543, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py”, line 108, in on_update
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/db_schema.py”, line 62, in updatedb
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/db_schema.py”, line 87, in sync
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/db_schema.py”, line 255, in alter
raise e
_mysql_exceptions.OperationalError: (1118, ‘Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs’)

You are hitting table size limit. There is a patch coming soon that will reduce “Data” fields to 140. For now, try changing a Data Custom Field to “Small Text” so that you can free up space.

Thank you so much :smile:

We face this problem without even using custom Data fields. What we use is a lot of Select, Check, Link, Int, Float, Attach. But still after creating ~50 custom fields, we get this error.

The next questions is how to move forward with this error once we start seing it. Because the the system does not allow saving files in the particular module. So far we have been restoring complete server with last day backup. But maybe there is another way, where we could remove the newly entered fields and keep working? I have deleted the custom fields from anywhere I find and make ‘clear cache’, but nothing helps.

Are you on the latest version?

ERPNext: v6.4.7
Frappe Framework: v6.4.9

But thereafter I found that one of the new field was still in the custom fields list. After deleting it I was able to save the documents in the module.
Can you confirm that if we delete a field in ‘custom fields’ it is also removed from the database?

Also, do you see a way of solving this issue completelly? We are trying to make base of our test reports and product assembly reports on it (‘Serial No’ module), so we definitelly will need more custom field in a very near future. Before upgrading to V6 I was hoping that the Barracuda thing will solve these issues, but this didn’t happen.


Deleting custom field doesn’t delete the column in the database. You can carefully drop it from the sql interface (bench mysql).

Yes, but unfortunately moving utf8mb4 balanced that out. We changed all data fields to varchar(140) from varchar(255) as a minor release after v6 and that has increased the ceiling for this.