Internal Server error and healthcare module missing

Suddenly the ERPNext is showing “Internal Server Error”. We’ve done the “bench update”, also with reset option.

The web error log shows this among others:

ModuleNotFoundError: No module named ‘erpnext.healthcare_healthcare’
Traceback (most recent call last):
File “/home/xxxx/frappe-bench/env/lib/python3.6/site-packages/rq/worker.py”, line 793, in perform_job
rv = job.perform()
File “/home/xxxxx/frappe-bench/env/lib/python3.6/site-packages/rq/job.py”, line 599, in perform
self._result = self._execute()
File “/home/xxxx/frappe-bench/env/lib/python3.6/site-packages/rq/job.py”, line 605, in _execute
return self.func(*self.args, **self.kwargs)
File “/home/xxxx/frappe-bench/apps/frappe/frappe/utils/background_jobs.py”, line 96, in execute_job
method = frappe.get_attr(method)
File “/home/xxxxx/frappe-bench/apps/frappe/frappe/init.py”, line 1046, in get_attr
return getattr(get_module(modulename), methodname)
File “/home/xxxx/frappe-bench/apps/frappe/frappe/init.py”, line 827, in get_module
return importlib.import_module(modulename)
File “/home/xxxx/frappe-bench/env/lib/python3.6/importlib/init.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 994, in _gcd_import
File “”, line 971, in _find_and_load
File “”, line 941, in _find_and_load_unlocked
File “”, line 219, in _call_with_frames_removed
File “”, line 994, in _gcd_import
File “”, line 971, in _find_and_load
File “”, line 941, in _find_and_load_unlocked
File “”, line 219, in _call_with_frames_removed
File “”, line 994, in _gcd_import
File “”, line 971, in _find_and_load
File “”, line 941, in _find_and_load_unlocked
File “”, line 219, in _call_with_frames_removed
File “”, line 994, in _gcd_import
File “”, line 971, in _find_and_load
File “”, line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named ‘erpnext.healthcare_healthcare’

How could we find what has gone wrong?
Git status shows version 12 for both frappe and erpnext and all ok.

You may try -

bench update --reset

Please note that any changes you have in the core will be lost.

yes, we made both

bench update
and also
bench update --reset

It came for a second or two after that a sad face of erpnext that it says that text that wait a while that we’ll be back and when refreshed it went back to Internal server error.
And indeed the web error log complains about the health care module missing. It has lot of error log, so there may be something else too.

The problem is that this ERP is in production, so hopefully the content won’t get ruined.

ADDED: Actually when running the “bench update”, the web address gets visible that “Don’t panic” text but when the bench update has run through, it becomes “Internal Server error” again.

ALSO the web.error.log has this, something related to “conf”:

[2020-04-17 19:29:25 +0000] [1976] [ERROR] Error handling request /
Traceback (most recent call last):
File “/home/xxxx/frappe-bench/apps/frappe/frappe/app.py”, line 53, in application
init_request(request)
File “/home/xxxx/frappe-bench/apps/frappe/frappe/app.py”, line 108, in init_request
frappe.init(site=site, sites_path=_sites_path)
File “/home/xxxx/frappe-bench/apps/frappe/frappe/init.py”, line 150, in init
local.conf = _dict(get_site_config())
File “/home/xxxx/frappe-bench/apps/frappe/frappe/init.py”, line 224, in get_site_config
sys.exit(1)
SystemExit: 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/xxxx/frappe-bench/env/lib/python3.6/site-packages/werkzeug/local.py”, line 72, in getattr
return self.storage[self.ident_func()][name]
KeyError: ‘conf’

looks like the default site is missing in sites/currentsite.txt, please try this -

bench use [your-site-name]

currentsite.txt has already written “site1.local”

@generare is right…

it’s this commit, line 272 in erpnext/hooks.py

should be erpnext.healthcare.doctype.patient_appointment.patient_appointment.send_appointment_reminder

1 Like

Thanks @akurungadam for the fix, merged the fix in version-12 branch.

2 Likes