[URGENT] Server down with TypeError: unsupported operand type(s)

Hello,

I am using ERPNext V5 deployed on DigitalOcean. Working fine for more than an year.

Today following error message start to appear when I tried to access erpnext

“The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.”

Upon some investigation I found following error in the logs

[2016-08-23 12:37:40,345: ERROR/MainProcess] Task frappe.tasks.enqueue_events_for_site[dd517dab-c7a0-4400-9f6c-19c159bc2f1e] raised unexpected: TypeError(“unsupported operand type(s) for +: ‘NoneType’ and ‘unicode’”,)
Traceback (most recent call last):
File “/home/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/celery/app/trace.py”, line 240, in trace_task
R = retval = fun(*args, **kwargs)
File “/home/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/celery/app/trace.py”, line 437, in protected_call
return self.run(*args, **kwargs)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/tasks.py”, line 108, in enqueue_events_for_site
enqueue_events(site)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/utils/scheduler.py”, line 21, in enqueue_events
if is_scheduler_disabled():
File “/home/erpnext/frappe-bench/apps/frappe/frappe/utils/scheduler.py”, line 105, in is_scheduler_disabled
return not frappe.utils.cint(frappe.db.get_default(“enable_scheduler”))
File “/home/erpnext/frappe-bench/apps/frappe/frappe/database.py”, line 459, in get_default
d = frappe.defaults.get_defaults(parent).get(key)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/defaults.py”, line 52, in get_defaults
userd = get_defaults_for(user)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/defaults.py”, line 140, in get_defaults_for
defaults = frappe.cache().get_value("__defaults:" + parent)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/memc.py”, line 19, in get_value
val = self.get(self.n(key))
File “/home/erpnext/frappe-bench/apps/frappe/frappe/memc.py”, line 10, in n
return (frappe.conf.db_name + “:” + key.replace(" ", “_”)).encode(‘utf-8’)
TypeError: unsupported operand type(s) for +: ‘NoneType’ and ‘unicode’

[2016-08-23 14:39:28,004: WARNING/MainProcess] celery@LifePlus7 ready.
[2016-08-23 14:40:36,732: ERROR/MainProcess] Task frappe.tasks.enqueue_events_for_site[9732859a-4cd8-4cbc-9615-6b180bb59285] raised unexpected: TypeError(“unsupported operand type(s) for +: ‘NoneType’ and ‘unicode’”,)
Traceback (most recent call last):
File “/home/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/celery/app/trace.py”, line 240, in trace_task
R = retval = fun(*args, **kwargs)
File “/home/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/celery/app/trace.py”, line 437, in protected_call
return self.run(*args, **kwargs)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/tasks.py”, line 108, in enqueue_events_for_site
enqueue_events(site)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/utils/scheduler.py”, line 21, in enqueue_events
if is_scheduler_disabled():
File “/home/erpnext/frappe-bench/apps/frappe/frappe/utils/scheduler.py”, line 105, in is_scheduler_disabled
return not frappe.utils.cint(frappe.db.get_default(“enable_scheduler”))
File “/home/erpnext/frappe-bench/apps/frappe/frappe/database.py”, line 459, in get_default
d = frappe.defaults.get_defaults(parent).get(key)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/defaults.py”, line 52, in get_defaults
userd = get_defaults_for(user)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/defaults.py”, line 140, in get_defaults_for
defaults = frappe.cache().get_value("__defaults:" + parent)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/memc.py”, line 19, in get_value
val = self.get(self.n(key))
File “/home/erpnext/frappe-bench/apps/frappe/frappe/memc.py”, line 10, in n
return (frappe.conf.db_name + “:” + key.replace(" ", “")).encode(‘utf-8’)
TypeError: unsupported operand type(s) for +: ‘NoneType’ and ‘unicode’
[2016-08-23 14:45:36,779: ERROR/MainProcess] Task frappe.tasks.enqueue_events_for_site[14b40634-20c9-40ea-bee3-50c1badbb942] raised unexpected: TypeError(“unsupported operand type(s) for +: ‘NoneType’ and ‘unicode’”,)
Traceback (most recent call last):
File “/home/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/celery/app/trace.py”, line 240, in trace_task
R = retval = fun(*args, **kwargs)
File “/home/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/celery/app/trace.py”, line 437, in protected_call
return self.run(*args, **kwargs)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/tasks.py”, line 108, in enqueue_events_for_site
enqueue_events(site)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/utils/scheduler.py”, line 21, in enqueue_events
if is_scheduler_disabled():
File “/home/erpnext/frappe-bench/apps/frappe/frappe/utils/scheduler.py”, line 105, in is_scheduler_disabled
return not frappe.utils.cint(frappe.db.get_default(“enable_scheduler”))
File “/home/erpnext/frappe-bench/apps/frappe/frappe/database.py”, line 459, in get_default
d = frappe.defaults.get_defaults(parent).get(key)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/defaults.py”, line 52, in get_defaults
userd = get_defaults_for(user)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/defaults.py”, line 140, in get_defaults_for
defaults = frappe.cache().get_value("__defaults:" + parent)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/memc.py”, line 19, in get_value
val = self.get(self.n(key))
File “/home/erpnext/frappe-bench/apps/frappe/frappe/memc.py”, line 10, in n
return (frappe.conf.db_name + “:” + key.replace(" ", "
”)).encode(‘utf-8’)
TypeError: unsupported operand type(s) for +: ‘NoneType’ and ‘unicode’
[2016-08-23 14:50:36,838: ERROR/MainProcess] Task frappe.tasks.enqueue_events_for_site[a334c18c-3403-4725-9787-fdacd5676b41] raised unexpected: TypeError(“unsupported operand type(s) for +: ‘NoneType’ and ‘unicode’”,)

Did you change anything recently?

Somehow site_config.json was deleted from the system which was causing the system to show the error. After placing the site_config.json system is working fine. You can close this issue