bench.exceptions.CommandFailedError: supervisorctl restart frappe:


Why is this error occurring when I give bench restart. the previous thing was I was installing erpnext after that I had to restart and I am getting this.

Hi @Thaya_Govzig:

bench restart just works in production environment …

If your bench is running, stop in console with Ctrl+c … Maybe you closed your console and running bench is not “visible”. Take a look here:

Hope this helps.

Looks like they’re in production. That script on the previous answer is for development.

This is most likely a permission issue or just bad config

Try redoing the production setup

sudo bench setup production yourusername

You can run it twice to be sure

2 Likes

Hi @adam26d:

My answer is based on previous @Thaya_Govzig topic thread (When bench start is given this shows - #7 by Thaya_Govzig) so I guess they are not still in production :wink: I don’t really know.

I think bench restart causes exactly this error if you try it in development mode.

Btw, seems you are the creator of stop.py . Many thanks, made my day every day :joy: :joy:

2 Likes

It was a community effort that keeps giving :grin::grin:

what’s the reason for this

Installing erpnext…
An error occurred while installing erpnext: (‘Module Def’, ‘Accounts’, IntegrityError(1062, “Duplicate entry ‘Accounts’ for key ‘PRIMARY’”))
Traceback (most recent call last):
File “apps/frappe/frappe/model/base_document.py”, line 532, in db_insert
frappe.db.sql(
File “apps/frappe/frappe/database/database.py”, line 217, in sql
self._cursor.execute(query, values)
File “env/lib/python3.11/site-packages/pymysql/cursors.py”, line 153, in execute
result = self._query(query)
^^^^^^^^^^^^^^^^^^
File “env/lib/python3.11/site-packages/pymysql/cursors.py”, line 322, in _query
conn.query(q)
File “env/lib/python3.11/site-packages/pymysql/connections.py”, line 558, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “env/lib/python3.11/site-packages/pymysql/connections.py”, line 822, in _read_query_result
result.read()
File “env/lib/python3.11/site-packages/pymysql/connections.py”, line 1200, in read
first_packet = self.connection._read_packet()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “env/lib/python3.11/site-packages/pymysql/connections.py”, line 772, in _read_packet
packet.raise_for_error()
File “env/lib/python3.11/site-packages/pymysql/protocol.py”, line 221, in raise_for_error
err.raise_mysql_exception(self._data)
File “env/lib/python3.11/site-packages/pymysql/err.py”, line 143, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.IntegrityError: (1062, “Duplicate entry ‘Accounts’ for key ‘PRIMARY’”)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “apps/frappe/frappe/commands/site.py”, line 462, in install_app
_install_app(app, verbose=context.verbose, force=force)
File “apps/frappe/frappe/installer.py”, line 294, in install_app
add_module_defs(name, ignore_if_duplicate=force)
File “apps/frappe/frappe/installer.py”, line 633, in add_module_defs
d.insert(ignore_permissions=True, ignore_if_duplicate=ignore_if_duplicate)
File “apps/frappe/frappe/model/document.py”, line 295, in insert
self.db_insert(ignore_if_duplicate=ignore_if_duplicate)
File “apps/frappe/frappe/model/base_document.py”, line 559, in db_insert
raise frappe.DuplicateEntryError(self.doctype, self.name, e)
frappe.exceptions.DuplicateEntryError: (‘Module Def’, ‘Accounts’, IntegrityError(1062, “Duplicate entry ‘Accounts’ for key ‘PRIMARY’”))

when I use the command " Bench -site yoursitename.com install-app erpnext

Hi @Thaya_Govzig:

This happened because your previous app installation process has not been finished properly.
Check this video from Geoffrey Karani:

Please open separate topic for this question next time :slight_smile:
Hope this helps.