Issue Installing Healthcare App: Duplicate Entry

Hello,

When attempting to install the healthcare app on a site I get the following error. Any ideas on how to fix?

Operating System: Ubuntu 20.04
Frappe Version: 13.34.1
Erpnext Version: 13.34.1
Healthcare Version: 0.0.1

An error occurred while installing healthcare: (‘Module Def’, ‘Healthcare’, IntegrityError(1062, “Duplicate entry ‘Healthcare’ for key ‘PRIMARY’”))
Traceback (most recent call last):
File “apps/frappe/frappe/model/base_document.py”, line 400, in db_insert
frappe.db.sql(
File “apps/frappe/frappe/database/database.py”, line 174, in sql
self._cursor.execute(query, values)
File “env/lib/python3.8/site-packages/pymysql/cursors.py”, line 148, in execute
result = self._query(query)
File “env/lib/python3.8/site-packages/pymysql/cursors.py”, line 310, in _query
conn.query(q)
File “env/lib/python3.8/site-packages/pymysql/connections.py”, line 548, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File “env/lib/python3.8/site-packages/pymysql/connections.py”, line 775, in _read_query_result
result.read()
File “env/lib/python3.8/site-packages/pymysql/connections.py”, line 1156, in read
first_packet = self.connection._read_packet()
File “env/lib/python3.8/site-packages/pymysql/connections.py”, line 725, in _read_packet
packet.raise_for_error()
File “env/lib/python3.8/site-packages/pymysql/protocol.py”, line 221, in raise_for_error
err.raise_mysql_exception(self._data)
File “env/lib/python3.8/site-packages/pymysql/err.py”, line 143, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.IntegrityError: (1062, “Duplicate entry ‘Healthcare’ for key ‘PRIMARY’”)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “apps/frappe/frappe/commands/site.py”, line 293, in install_app
_install_app(app, verbose=context.verbose)
File “apps/frappe/frappe/installer.py”, line 184, in install_app
add_module_defs(name)
File “apps/frappe/frappe/installer.py”, line 496, in add_module_defs
d.save(ignore_permissions=True)
File “apps/frappe/frappe/model/document.py”, line 310, in save
return self._save(*args, **kwargs)
File “apps/frappe/frappe/model/document.py”, line 332, in _save
return self.insert()
File “apps/frappe/frappe/model/document.py”, line 276, in insert
raise e
File “apps/frappe/frappe/model/document.py”, line 273, in insert
self.db_insert()
File “apps/frappe/frappe/model/base_document.py”, line 425, in db_insert
raise frappe.DuplicateEntryError(self.doctype, self.name, e)
frappe.exceptions.DuplicateEntryError: (‘Module Def’, ‘Healthcare’, IntegrityError(1062, “Duplicate entry ‘Healthcare’ for key ‘PRIMARY’”))

You should be installing the healthcare app on v14 frappe and erpnext. Basically after migrating your version-13 site to one of the v14 develop or one of the beta release branches. Hope you’ll note to keep a backup if the site is on production

2 Likes

Thanks!