pymysql.err.InternalError: (1069, u'Too many keys specified; max 64 keys allowed') v12 branch

So I was able to install Frappe and ERP from v10 to v12 branch.
Aldo, I was able to restore database from V10.

What really gives me an error are the Custom Doctypes and Custom Fields.

After I execute migrate it gives me this error:

Traceback (most recent call last):
  File "/usr/lib/python2.7/", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/", line 72, in _run_code
    exec code in run_globals
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/", line 97, in <module>
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/", line 18, in main
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/", line 717, in main
    rv = self.invoke(ctx)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/", line 25, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/", line 228, in migrate
    migrate(context.verbose, rebuild_website=rebuild_website)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/", line 51, in migrate
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/", line 24, in sync_fixtures
    ignore_links=True, overwrite=True)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/data_import/", line 56, in import_doc
    frappe.modules.import_file.import_file_by_path(f, data_import=True, force=True, pre_process=pre_process, reset_permissions=True)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/", line 66, in import_file_by_path
    ignore_version=ignore_version, reset_permissions=reset_permissions)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/", line 141, in import_doc
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/", line 255, in insert
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/", line 912, in run_post_save_methods
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/", line 781, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/", line 1051, in composer
    return composed(self, method, *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/", line 1034, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/", line 775, in <lambda>
    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/custom/doctype/custom_field/", line 67, in on_update
  File "/home/frappe/frappe-bench/apps/frappe/frappe/database/mariadb/", line 282, in updatedb
  File "/home/frappe/frappe-bench/apps/frappe/frappe/database/", line 36, in sync
  File "/home/frappe/frappe-bench/apps/frappe/frappe/database/mariadb/", line 86, in alter
    raise e
pymysql.err.InternalError: (1069, u'Too many keys specified; max 64 keys allowed')

Any idea how to fix it? And what causes this problem?

1 Like

How many of the fields in this doctype are Indexed?


@adityahase, @aldoblack

It’s already reported, pls can your both comment in github, because there’s months I reported this

In which doctype?

It has been reported since January and nothing.

The Custom DocTypes you are having trouble with.

How do I identify it with? There are plenty Custom Doctypes that I have created.

Same error occured any solution for this.

Any update or guidance on this would be helpful.

While trying to follow instructions @Tropicalrambler “Our Enterprise Strategy and ERPNext” from Medium, I created 60 +Indexes on tabProject on “project_name” and “github_sync_id”. And why is the “github_sync_id” thrown in there, could it be causing any issues?

The instructions said to create a Kanban board first but I couldn’t create a new Kanban Board using “Project” Reference DocType and insert a new field, it had to be of type “Select” and predefined.

I’ve since deleted the indexes but still don’t understand why they were created in the first place. Any guidance on this would be appreciated.

ERPNext: v11.1.20 (v12)
Frappe Framework: v11.1.21 (v12)

I just saw your post. Let me look into it and I will let you know if I can find anything specific to help you.


After updating to v12.x.x-develop I retried setting the Kanboard first but I still had to create a custom “kanban_field” of type “select” under Projects first. But this time I was able to do so…


The index creation issue remains. It looks like the indexes are auto-created with a “_count” appended but I noticed that the index check only checks for identical index names.

If that’s the right bit of code?
Again, any thoughts?


I am having this same prolem with " Items" doctype and this is my second time encoutered with this issue, the first time i solved this by building a new site, but keep building a new site is not a very good solution…
Anyone can help please?

I’have same pblm …pls help anyone

I receive the same error after adding a custom field to Employee through Customize Form and adding Custom Field to the, then exporting fixtures by running bench --site site_name export-fixtures.

I’ve solved it once by creating a new bench and new site and restoring my database. This is not a sustainable solution as the error occurred again. For now I’m reverting back to Version 11.


I have found the problem and the cause of this. See my issue posted

1 Like

Hello Everyone, I seem to having the same error, Please how were you able to fix yours?