Nonunique Error: Customer: Field 'Customer Series' cannot be set as Unique

i have non unique data and i was have the validation but i remove it before migrate

meta = <Meta: Customer>
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 652, in throw
  msgprint(
    msg = "Customer: Field 'Customer Series' cannot be set as Unique as it has non-unique values"
    exc = <class 'frappe.core.doctype.doctype.doctype.NonUniqueError'>
    title = None
    is_minimizable = False
    wide = False
    as_list = False
    primary_action = None
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 617, in msgprint
  _raise_exception()
    title = None
    as_table = False
    as_list = False
    indicator = 'red'
    alert = False
    primary_action = None
    is_minimizable = False
    wide = False
    realtime = False
    sys = <module 'sys' (built-in)>
    _raise_exception = <function msgprint.<locals>._raise_exception at 0x7835dc7436d0>
    msg = "Customer: Field 'Customer Series' cannot be set as Unique as it has non-unique values"
    out = {'message': "Customer: Field 'Customer Series' cannot be set as Unique as it has non-unique values", 'title': 'Message', 'indicator': 'red', 'raise_exception': 1, '__frappe_exc_id': 'c5c7495867c4c54553bbab352887d509049a3be1133cbbcb5c06588b'}
    raise_exception = <class 'frappe.core.doctype.doctype.doctype.NonUniqueError'>
    ...skipped... 1 vars
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 568, in _raise_exception
  raise exc
    exc = NonUniqueError("Customer: Field 'Customer Series' cannot be set as Unique as it has non-unique values")
    msg = "Customer: Field 'Customer Series' cannot be set as Unique as it has non-unique values"
    out = {'message': "Customer: Field 'Customer Series' cannot be set as Unique as it has non-unique values", 'title': 'Message', 'indicator': 'red', 'raise_exception': 1, '__frappe_exc_id': 'c5c7495867c4c54553bbab352887d509049a3be1133cbbcb5c06588b'}
    raise_exception = <class 'frappe.core.doctype.doctype.doctype.NonUniqueError'>
    ...skipped... 1 vars
frappe.core.doctype.doctype.doctype.NonUniqueError: Customer: Field 'Customer Series' cannot be set as Unique as it has non-unique values

Issue is that you tried to make the “Customer Series” field unique, but there are already some duplicate values in that field. When a field is set to be unique, it means no two records can have the same value in that field. The error occurs because the system found duplicates, which prevents it from allowing the uniqueness rule. To fix this, you need to remove or change the duplicate values in the “Customer Series” field before setting it to unique again.

How it works:

i made it non unique
why the migrate does not work?!

i fixed it by export customization then


run command bench --site [sitename] export-fixtures
then run bench --site [sitename] migrate
worked well. :+1: