How to completely purge a corrupted app?

I installed a defective app.

erpdev@loso:~/frappe-bench-DLS$ bench get-app git@github.com:mystuff/Widget.git;
erpdev@loso:~/frappe-bench-DLS$ bench --site mysite install-app widget;

Installing widget...
An error occurred while installing widget:
Module import failed for Widget Babies (widget.widget.doctype.widget_babies.widget_babies Error: No module named 'widget.widget.doctype.widget_babies.widget_babies')
erpdev@loso:~/frappe-bench-DLS$ 

I figured out the error and tried to reinstall, but get the error:

erpdev@loso:~/frappe-bench-DLS$ bench --site mysite install-app widget;
Installing widget...

An error occurred while installing widget:
('Module Def', 'Widget', IntegrityError(1062, "Duplicate entry 'Widget' for key 'PRIMARY'"))
erpdev@loso:~/frappe-bench-DLS$ 

I tried uninstalling and then reinstalling, but with the same result:

erpdev@loso:~/frappe-bench-DLS$ bench --site mysite remove-from-installed-apps widget;
erpdev@loso:~/frappe-bench-DLS$ bench --site mysite uninstall-app widget;
App widget not installed on Site mysite
erpdev@loso:~/frappe-bench-DLS$ bench --site mysite install-app widget;

An error occurred while installing widget:
('Module Def', 'Widget', IntegrityError(1062, "Duplicate entry 'Widget' for key 'PRIMARY'"))
erpdev@loso:~/frappe-bench-DLS$ 

Questions

Where can I find the duplicate entry?
Can I remove it with an SQL command?

select * from `tabModule Def` where `name` like "%Widget%"

Yes, but take backup before execute, (recommended)

delete from `tabModule Def` where `name` LIKE "%Widget%"
1 Like

This is great. Thank you!

I’ll be trying that out a bit later today.

:100: