Bench error - the site stuck at updating :(

altan@ERP:~/frappe-bench$ bench migrate
Migrating site1.local
Executing frappe.patches.v6_9.int_float_not_null in site1.local (1bd3e0294d)
Traceback (most recent call last):
File “/usr/lib/python2.7/”, line 162, 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/altan/frappe-bench/apps/frappe/frappe/utils/”, line 79, in
File “/home/altan/frappe-bench/apps/frappe/frappe/utils/”, line 16, in main
File “/home/altan/frappe-bench/env/local/lib/python2.7/site-packages/click/”, line 700, in call
return self.main(*args, **kwargs)
File “/home/altan/frappe-bench/env/local/lib/python2.7/site-packages/click/”, line 680, in main
rv = self.invoke(ctx)
File “/home/altan/frappe-bench/env/local/lib/python2.7/site-packages/click/”, line 1027, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/altan/frappe-bench/env/local/lib/python2.7/site-packages/click/”, line 1027, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/altan/frappe-bench/env/local/lib/python2.7/site-packages/click/”, line 873, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/altan/frappe-bench/env/local/lib/python2.7/site-packages/click/”, line 508, in invoke
return callback(*args, **kwargs)
File “/home/altan/frappe-bench/env/local/lib/python2.7/site-packages/click/”, line 16, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/altan/frappe-bench/apps/frappe/frappe/”, line 29, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/altan/frappe-bench/apps/frappe/frappe/”, line 213, in migrate
File “/home/altan/frappe-bench/apps/frappe/frappe/modules/”, line 25, in run_all
if not run_single(patchmodule = patch):
File “/home/altan/frappe-bench/apps/frappe/frappe/modules/”, line 52, in run_single
return execute_patch(patchmodule, method, methodargs)
File “/home/altan/frappe-bench/apps/frappe/frappe/modules/”, line 68, in execute_patch
frappe.get_attr(patchmodule.split()[0] + “.execute”)()
File “/home/altan/frappe-bench/apps/frappe/frappe/patches/v6_9/”, line 16, in execute
.format(doctype=doctype, fieldname=fieldname))
File “/home/altan/frappe-bench/apps/frappe/frappe/”, line 146, in sql
File “/home/altan/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/”, line 205, in execute
self.errorhandler(self, exc, value)
File “/home/altan/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/”, line 36, in defaulterrorhandler
raise errorclass, errorvalue
_mysql_exceptions.IntegrityError: (1062, “Duplicate entry ‘0’ for key ‘no’”)


You seem to have set a numeric field as unique. This shouldn’t have been allowed by design. We will have to fix this UI bug.

To proceed, run bench --site {yoursite} console.

If ‘no’ is a custom field:

cf = frappe.get_doc("Custom Field", {"fieldname": "no"})
cf.unique = 0

After that, try updating again.

I removed the patches from apps and patch directory then ran bench migrate. All works now but cannot find the field called no.

Console replies -
DoesNotExistError: Özel Alan {u’fieldname’: u’no’} bulunamadı
External access to custom fields

Check any custom doctype for the field ‘no’

I guess I found the criminal

Update was a success after removing the field called “no”