Errors in Local bench

Good Day Everyone,

I am facing a problem with the local bench, whenever I type the command “bench update” or “bench migrate” it gives me a (ConecctionError).
The latest command I tried was: “sudo bench update”, and it gave me this message:

Executing frappe.patches.v11_0.update_list_user_settings in xxxxxsite (978f8f60d22990bd)
Traceback (most recent call last):
  File "/usr/lib/python2.7/", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/", line 72, in _run_code
    exec code in run_globals
  File "/home/mohdbo/frappe-bench/apps/frappe/frappe/utils/", line 97, in <module>
  File "/home/mohdbo/frappe-bench/apps/frappe/frappe/utils/", line 18, in main
  File "/home/mohdbo/frappe-bench/env/local/lib/python2.7/site-packages/click/", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/mohdbo/frappe-bench/env/local/lib/python2.7/site-packages/click/", line 697, in main
    rv = self.invoke(ctx)
  File "/home/mohdbo/frappe-bench/env/local/lib/python2.7/site-packages/click/", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/mohdbo/frappe-bench/env/local/lib/python2.7/site-packages/click/", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/mohdbo/frappe-bench/env/local/lib/python2.7/site-packages/click/", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/mohdbo/frappe-bench/env/local/lib/python2.7/site-packages/click/", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/mohdbo/frappe-bench/env/local/lib/python2.7/site-packages/click/", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/mohdbo/frappe-bench/apps/frappe/frappe/commands/", line 25, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/mohdbo/frappe-bench/apps/frappe/frappe/commands/", line 222, in migrate
    migrate(context.verbose, rebuild_website=rebuild_website)
  File "/home/mohdbo/frappe-bench/apps/frappe/frappe/", line 39, in migrate
  File "/home/mohdbo/frappe-bench/apps/frappe/frappe/modules/", line 29, in run_all
    if not run_single(patchmodule = patch):
  File "/home/mohdbo/frappe-bench/apps/frappe/frappe/modules/", line 63, in run_single
    return execute_patch(patchmodule, method, methodargs)
  File "/home/mohdbo/frappe-bench/apps/frappe/frappe/modules/", line 83, in execute_patch
    frappe.get_attr(patchmodule.split()[0] + ".execute")()
  File "/home/mohdbo/frappe-bench/apps/frappe/frappe/patches/v11_0/", line 28, in execute
  File "/home/mohdbo/frappe-bench/apps/frappe/frappe/model/utils/", line 49, in sync_user_settings
    for key, data in iteritems(frappe.cache().hgetall('_user_settings')):
  File "/home/mohdbo/frappe-bench/apps/frappe/frappe/utils/", line 153, in hgetall
    iteritems(super(redis.Redis, self).hgetall(self.make_key(name)))}
  File "/home/mohdbo/frappe-bench/env/local/lib/python2.7/site-packages/redis/", line 1967, in hgetall
    return self.execute_command('HGETALL', name)
  File "/home/mohdbo/frappe-bench/env/local/lib/python2.7/site-packages/redis/", line 673, in execute_command
  File "/home/mohdbo/frappe-bench/env/local/lib/python2.7/site-packages/redis/", line 610, in send_command
  File "/home/mohdbo/frappe-bench/env/local/lib/python2.7/site-packages/redis/", line 585, in send_packed_command
  File "/home/mohdbo/frappe-bench/env/local/lib/python2.7/site-packages/redis/", line 489, in connect
    raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error 111 connecting to localhost:13000. Connection refused.

I would be grateful if someone provided me with a solution.
Thank You

Two things:

  1. You shouldn’t use sudo for bench update. It’ll mess up permissions of all folders and files.
  2. I presume bench is not started, which is why redis is not started, which is why you’re getting the error. If I’m incorrect please give some more details, like are you in a developer or production environment, and are you able to access the site via the browser?
1 Like

Thank you for replying @codingCoffee
You are correct, the bench is not started, I have more than one site and they are all in developer mode, and I only access the site via browser.
I hope this answers your questions.
if you need more info let me know.
Thank You

You’ll have to start bench before updating/migrating

1 Like

Hello @codingCoffee,
Sorry for replying late.
I have done as you instructed, but still no luck. The same error message appears.
Do you have any other ideas??
Thank You