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/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/mohdbo/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 97, in <module>
    main()
  File "/home/mohdbo/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 18, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/home/mohdbo/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/mohdbo/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/mohdbo/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", 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/core.py", 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/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/mohdbo/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/mohdbo/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/mohdbo/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 25, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/mohdbo/frappe-bench/apps/frappe/frappe/commands/site.py", line 222, in migrate
    migrate(context.verbose, rebuild_website=rebuild_website)
  File "/home/mohdbo/frappe-bench/apps/frappe/frappe/migrate.py", line 39, in migrate
    frappe.modules.patch_handler.run_all()
  File "/home/mohdbo/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 29, in run_all
    if not run_single(patchmodule = patch):
  File "/home/mohdbo/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 63, in run_single
    return execute_patch(patchmodule, method, methodargs)
  File "/home/mohdbo/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 83, in execute_patch
    frappe.get_attr(patchmodule.split()[0] + ".execute")()
  File "/home/mohdbo/frappe-bench/apps/frappe/frappe/patches/v11_0/update_list_user_settings.py", line 28, in execute
    sync_user_settings()
  File "/home/mohdbo/frappe-bench/apps/frappe/frappe/model/utils/user_settings.py", 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/redis_wrapper.py", 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/client.py", line 1967, in hgetall
    return self.execute_command('HGETALL', name)
  File "/home/mohdbo/frappe-bench/env/local/lib/python2.7/site-packages/redis/client.py", line 673, in execute_command
    connection.send_command(*args)
  File "/home/mohdbo/frappe-bench/env/local/lib/python2.7/site-packages/redis/connection.py", line 610, in send_command
    self.send_packed_command(self.pack_command(*args))
  File "/home/mohdbo/frappe-bench/env/local/lib/python2.7/site-packages/redis/connection.py", line 585, in send_packed_command
    self.connect()
  File "/home/mohdbo/frappe-bench/env/local/lib/python2.7/site-packages/redis/connection.py", 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