Bench update error "frappe.exceptions.LinkExistsError"

Basically during a bench update, I am getting: “frappe.exceptions.LinkExistsError: Cannot delete or cancel because Module Def Contacts is linked with DocType Assets”. I know the cause, I have a custom doc type called Assets which are linked to Contacts. Unfortunately, I cannot get back into the product to remove the link and no other way around this.

Thoughts on how to resolve and how to avoid this in the future?

We pushed an update to that patch to move the custom doctype to “CRM” module. Try updating again.

Thanks for the quick reply. Unfortunately no… getting:

frappe.exceptions.LinkExistsError: Cannot delete or cancel because Module Def Contacts is linked with DocType Assets

Unfortunately not working… getting:
frappe.exceptions.LinkExistsError: Cannot delete or cancel because Module Def Contacts is linked with DocType Assets

Thanks for the quick reply, any idea how to fix or to undo the update entirely?

You can disregard… I found a way around this by changing the maria db module name in my doc type, completing the bench update and renaming it back. The custom flag was set to 1 already, so not sure why this issue happened.

@msj I am pretty sure we pushed a fix. Anyways its good you fixed it.

Hi, I’m having also this kind of issue. I saw that @msj has found solution for this. From where I can change the maria db module name?

You can login to the maria db using the command line mysql -uroot -p[your password] and hit enter You will then be prompted for your password, enter that and hit enter again.

Once logged in, do a show databases; command and find your company db. In my case it was a random string of numbers. Then type use [string of chars] ; That will switch you to that db to active. Not knowing your exact error, I will share what I had to do. If you use my solution below, it will likely do nothing for you. You will need to translate for your situation. I typed:

UPDATE tabDocType SET module ='ContactsOld' where NAME ='Assets';

Then I ran the bench update and reversed the name back

UPDATE tabDocType SET module ='Contacts' where NAME ='Assets';

Hope this helps,

This was a life saver, your solution worked perfectly. Thanks!

You bet. Glad it helped…