frappe.exceptions.ValidationError: Number <b>2347030441822</b> cannot be set as primary for Phone as well as Mobile No

Hello all,
I just executed a bench restore with a backup file from an erpnext application which is currently in operation to another erpnext application on my vmware which I installed.

After running the --force restore command, I ran the bench migrate and I got this error.

Traceback (most recent call last):
File “/usr/lib/python3.6/”, line 193, in _run_module_as_main
main”, mod_spec)
File “/usr/lib/python3.6/”, line 85, in _run_code
exec(code, run_globals)
File “/home/interra/frappe-bench/apps/frappe/frappe/utils/”, line 97, in
File “/home/interra/frappe-bench/apps/frappe/frappe/utils/”, line 18, in main
File “/home/interra/frappe-bench/env/lib/python3.6/site-packages/click/”, line 764, in call
return self.main(*args, **kwargs)
File “/home/interra/frappe-bench/env/lib/python3.6/site-packages/click/”, line 717, in main
rv = self.invoke(ctx)
File “/home/interra/frappe-bench/env/lib/python3.6/site-packages/click/”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/interra/frappe-bench/env/lib/python3.6/site-packages/click/”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/interra/frappe-bench/env/lib/python3.6/site-packages/click/”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/interra/frappe-bench/env/lib/python3.6/site-packages/click/”, line 555, in invoke
return callback(*args, **kwargs)
File “/home/interra/frappe-bench/env/lib/python3.6/site-packages/click/”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/interra/frappe-bench/apps/frappe/frappe/commands/”, line 25, in _func
ret = f(frappe.dict(ctx.obj), *args, **kwargs)
File “/home/interra/frappe-bench/apps/frappe/frappe/commands/”, line 233, in migrate
migrate(context.verbose, rebuild_website=rebuild_website, skip_failing=skip_failing)
File “/home/interra/frappe-bench/apps/frappe/frappe/”, line 48, in migrate
File “/home/interra/frappe-bench/apps/frappe/frappe/modules/”, line 41, in run_all
File “/home/interra/frappe-bench/apps/frappe/frappe/modules/”, line 30, in run_patch
if not run_single(patchmodule = patch):
File “/home/interra/frappe-bench/apps/frappe/frappe/modules/”, line 71, in run_single
return execute_patch(patchmodule, method, methodargs)
File “/home/interra/frappe-bench/apps/frappe/frappe/modules/”, line 91, in execute_patch
frappe.get_attr(patchmodule.split()[0] + “.execute”)()
File “/home/interra/frappe-bench/apps/frappe/frappe/patches/v11_0/”, line 23, in execute
create_contact(user, ignore_links=True, ignore_mandatory=True)
File “/home/interra/frappe-bench/apps/frappe/frappe/core/doctype/user/”, line 1047, in create_contact
contact.insert(ignore_permissions=True, ignore_links=ignore_links, ignore_mandatory=ignore_mandatory)
File “/home/interra/frappe-bench/apps/frappe/frappe/model/”, line 228, in insert
File “/home/interra/frappe-bench/apps/frappe/frappe/model/”, line 886, in run_before_save_methods
File “/home/interra/frappe-bench/apps/frappe/frappe/model/”, line 786, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/interra/frappe-bench/apps/frappe/frappe/model/”, line 1056, in composer
return composed(self, method, *args, **kwargs)
File “/home/interra/frappe-bench/apps/frappe/frappe/model/”, line 1039, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/interra/frappe-bench/apps/frappe/frappe/model/”, line 780, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/interra/frappe-bench/apps/frappe/frappe/contacts/doctype/contact/”, line 35, in validate
File “/home/interra/frappe-bench/apps/frappe/frappe/contacts/doctype/contact/”, line 125, in check_if_primary_phone_and_mobile_no_same
(“Number {0} cannot be set as primary for Phone as well as Mobile No.”).format(number))
File “/home/interra/frappe-bench/apps/frappe/frappe/”, line 360, in throw
msgprint(msg, raise_exception=exc, title=title, indicator=‘red’)
File “/home/interra/frappe-bench/apps/frappe/frappe/”, line 346, in msgprint
File “/home/interra/frappe-bench/apps/frappe/frappe/”, line 315, in _raise_exception
raise raise_exception(msg)
frappe.exceptions.ValidationError: Number 2347030441822 cannot be set as primary for Phone as well as Mobile No.

I will be grateful if anyone can render me any form of support so that I may be able to fix this error.

The reason why I embarked on this force restore was to see how I can restore a version 10 backup file to a freshly installed version 12 erpnext application which is running on my vmware. I’m still new and learning erpnext and will appreciate any form of support in resolving this error. Thank you.

You need to identify the particular Contact that violates this validation rule, and delete the problem mobile phone # entry. Do this ideally from the UI client, otherwise you must access the database.

That’s actually what I did. I went back to the site, traced where the number was registered, and then edited it. Thanks alot.