JSONDecodeError after restarting the server

Hi,

ERPNext was working fine, then I restarted the server and out of nowhere, the page started showing “Internal Server Error”. Here is the log:

Traceback (most recent call last):
  File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 97, in <module>
    main()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 18, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/home/frappe/frappe-bench/env/lib/python3.5/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/lib/python3.5/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/frappe/frappe-bench/env/lib/python3.5/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/lib/python3.5/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/lib/python3.5/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/frappe/frappe-bench/env/lib/python3.5/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/lib/python3.5/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 25, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py", line 182, in list_apps
    frappe.init(site=site)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 150, in init
    local.conf = _dict(get_site_config())
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 221, in get_site_config
    config.update(get_file_json(site_config))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1004, in get_file_json
    return json.load(f)
  File "/usr/lib/python3.5/json/__init__.py", line 268, in load
    parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
  File "/usr/lib/python3.5/json/__init__.py", line 319, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.5/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.5/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
[2019-09-18 02:02:44 +0000] [1463] [INFO] Starting gunicorn 19.9.0
[2019-09-18 02:02:44 +0000] [1463] [INFO] Listening at: http://127.0.0.1:8000 (1463)
[2019-09-18 02:02:44 +0000] [1463] [INFO] Using worker: sync
[2019-09-18 02:02:44 +0000] [1542] [INFO] Booting worker with pid: 1542
[2019-09-17 20:32:53 +0000] [1542] [ERROR] Error handling request /api/method/frappe.realtime.get_user_info?sid=661c2ac4d616730775956b174e2ca464bd7e4e5a5180fae9b09cbbf9
Traceback (most recent call last):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 52, in application
    init_request(request)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 105, in init_request
    frappe.init(site=site, sites_path=_sites_path)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 150, in init
    local.conf = _dict(get_site_config())
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 221, in get_site_config
    config.update(get_file_json(site_config))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1004, in get_file_json
    return json.load(f)
  File "/usr/lib/python3.5/json/__init__.py", line 268, in load
    parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
  File "/usr/lib/python3.5/json/__init__.py", line 319, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.5/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.5/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/frappe/frappe-bench/env/lib/python3.5/site-packages/werkzeug/local.py", line 72, in __getattr__
    return self.__storage__[self.__ident_func__()][name]
KeyError: 'conf'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/frappe/frappe-bench/env/lib/python3.5/site-packages/werkzeug/local.py", line 309, in _get_current_object
    return getattr(self.__local, self.__name__)
  File "/home/frappe/frappe-bench/env/lib/python3.5/site-packages/werkzeug/local.py", line 74, in __getattr__
    raise AttributeError(name)
AttributeError: conf

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/frappe/frappe-bench/env/lib/python3.5/site-packages/gunicorn/workers/sync.py", line 135, in handle
    self.handle_request(listener, req, client, addr)
  File "/home/frappe/frappe-bench/env/lib/python3.5/site-packages/gunicorn/workers/sync.py", line 176, in handle_request
    respiter = self.wsgi(environ, resp.start_response)
  File "/home/frappe/frappe-bench/env/lib/python3.5/site-packages/werkzeug/local.py", line 231, in application
    return ClosingIterator(app(environ, start_response), self.cleanup)
  File "/home/frappe/frappe-bench/env/lib/python3.5/site-packages/werkzeug/wrappers/base_request.py", line 237, in application
    resp = f(*args[:-2] + (request,))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 81, in application
    response = handle_exception(e)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 187, in handle_exception
    make_error_snapshot(e)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/error.py", line 21, in make_error_snapshot
    if frappe.conf.disable_error_snapshot:
  File "/home/frappe/frappe-bench/env/lib/python3.5/site-packages/werkzeug/local.py", line 348, in __getattr__
    return getattr(self._get_current_object(), name)
  File "/home/frappe/frappe-bench/env/lib/python3.5/site-packages/werkzeug/local.py", line 311, in _get_current_object
    raise RuntimeError("no object bound to %s" % self.__name__)
RuntimeError: no object bound to conf
[2019-09-17 20:32:59 +0000] [1463] [INFO] Handling signal: term
[2019-09-17 20:32:59 +0000] [1542] [INFO] Worker exiting (pid: 1542)
[2019-09-17 20:32:59 +0000] [1463] [INFO] Shutting down: Master
[2019-09-17 20:33:05 +0000] [1865] [INFO] Starting gunicorn 19.9.0
[2019-09-17 20:33:05 +0000] [1865] [INFO] Listening at: http://127.0.0.1:8000 (1865)
[2019-09-17 20:33:05 +0000] [1865] [INFO] Using worker: sync
[2019-09-17 20:33:05 +0000] [1918] [INFO] Booting worker with pid: 1918

I have absolutely no idea what’s wrong, cause I changed nothing and everything seems a bit off.

Help would be much appreciated

Thanks!

I faced the same problem. See solution Library does not exist - #24 by saurabh6790