Row size too large - update error

Problem:

  • I added over 50 custom fields to the Opportunity form.
  • I reached the limit and was getting errors when trying to add more fields or save the form.
  • I deleted some fields and have NO PROBLEM saving forms in ERPNext
  • I get an error message of “Row size too large” when I try to update the system

I tried deleting ALL the customizations from the Opportunity form, and I still get the same error when trying to update.

Is there some kind of database cache I need to clear? Why does it still say “Row size too large” even after I delete all customizations, save, refresh, logout, and then run bench update?

Thank you for any and all help!

Error:

    Executing erpnext.patches.v9_1.create_issue_opportunity_type in site1.local (1bd3e0294d)
    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 94, 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/local/lib/python2.7/site-packages/click/core.py", line 716, in __call__
        return self.main(*args, **kwargs)
      File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 696, in main
        rv = self.invoke(ctx)
      File "/home/frappe/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/frappe/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/frappe/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/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 534, in invoke
        return callback(*args, **kwargs)
      File "/home/frappe/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/frappe/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 24, in _func
        ret = f(frappe._dict(ctx.obj), *args, **kwargs)
      File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py", line 222, in migrate
        migrate(context.verbose, rebuild_website=rebuild_website)
      File "/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py", line 31, in migrate
        frappe.modules.patch_handler.run_all()
      File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 29, in run_all
        if not run_single(patchmodule = patch):
      File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 63, in run_single
        return execute_patch(patchmodule, method, methodargs)
      File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 83, in execute_patch
        frappe.get_attr(patchmodule.split()[0] + ".execute")()
      File "/home/frappe/frappe-bench/apps/erpnext/erpnext/patches/v9_1/create_issue_opportunity_type.py", line 18, in execute
        frappe.reload_doc('crm', 'doctype', 'opportunity')
      File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 695, in reload_doc
        return frappe.modules.reload_doc(module, dt, dn, force=force, reset_permissions=reset_permissions)
      File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/utils.py", line 155, in reload_doc
        return import_files(module, dt, dn, force=force, reset_permissions=reset_permissions)
      File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 19, in import_files
        reset_permissions=reset_permissions)
      File "/home/frappe/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/frappe/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/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 132, in import_doc
        doc.insert()
      File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 245, in insert
        self.run_post_save_methods()
      File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 887, in run_post_save_methods
        self.run_method("on_update")
      File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 755, in run_method
        out = Document.hook(fn)(self, *args, **kwargs)
      File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1024, in composer
        return composed(self, method, *args, **kwargs)
      File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1007, in runner
        add_to_return_value(self, fn(self, *args, **kwargs))
      File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 749, in <lambda>
        fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
      File "/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 208, in on_update
        updatedb(self.name, self)
      File "/home/frappe/frappe-bench/apps/frappe/frappe/model/db_schema.py", line 76, in updatedb
        tab.sync()
      File "/home/frappe/frappe-bench/apps/frappe/frappe/model/db_schema.py", line 155, in sync
        self.alter()
      File "/home/frappe/frappe-bench/apps/frappe/frappe/model/db_schema.py", line 354, in alter
        raise e
    pymysql.err.InternalError: (1118, u'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')

When you delete custom fields from the Frappe UI, the columns dont actually get deleted from the database - they remain. You will have to go into the database and actually manually delete the unneeded columns from the tabOpportunity table.

3 Likes

Thank you, thank you, thank you. Now, I’ve never worked directly with the database before. I assume I need to do that from the console? I did some google searches but honestly I’m just not sure what I should be looking for for instructions. Any chance you could point me in the right direction?

Hi,
you can see all custom fields which where created for Opportunity

~/frappe-bench$ bench mysql
select name from tabCustom Field where dt=“Opportunity”;

you can delete all custom fields which where created for Opportunity

delete from tabCustom Field where dt=“Opportunity”;

1 Like

Not quite. The commands are accurate, but @Dbone will actually have to delete columns in tabOpportunity.

bench --site [sitename] mysql

then

alter table tabOpportunity drop column `{column_name}`;
2 Likes

Thank you, I managed to login, view, and delete extra columns. My initial error is now solved, on to the next one. Lol.

To understand the error, you can read the following article.
https://erpnext.org/docs/user/manual/en/customize-erpnext/articles/maximum-numbers-of-fields-in-a-form

1 Like