404 not found error after dropping site

After dropping a site and creating a new site it shows the 404 not found error with the message (old site name) not found.

I have tried bench use (new site)

bench build
bench migrate

nothing is working. Please suggest

Hi @Nayan_Patel,

When you drop a site, it completely deletes all the data related to that site including the database and files. Therefore, if you create a new site with the same name as the old site, you may still get the 404 not found error because the old site’s data has been removed.

To resolve this issue, you can try the following steps:

  1. Try clearing the browser cache or try accessing the site in a different browser.
  2. Double-check if the site has been created successfully by running the command
    /frappe-bench/sites$ ls in your terminal. If the new site is listed, then it has been created successfully.
  3. If the new site has been created successfully, then try restarting the bench using the command bench restart.
  4. If the issue still persists, try creating a new site with a different name and see if that works. If it does, then it means that there is some issue with the old site’s data that is causing the error.
  5. If none of the above steps work, you can try restoring a backup of your ERPNext instance to a previous state where the old site was still present.

I hope these steps help you resolve the issue.

Thank You!

Hi,

When I run bench restart, I get this error.

bitnami@fishwiki:/opt/bitnami/erpnext/frappe-bench$ bench restart
$ sudo supervisorctl restart frappe:
frappe: ERROR (no such group)
frappe: ERROR (no such group)
ERROR:
subprocess.CalledProcessError: Command 'sudo supervisorctl restart frappe:' returned non-zero exit status 2.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/bitnami/erpnext/bin/bench", line 8, in <module>
    sys.exit(cli())
  File "/opt/bitnami/erpnext/bench/bench/cli.py", line 127, in cli
    bench_command()
  File "/opt/bitnami/erpnext/venv/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/opt/bitnami/erpnext/venv/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/opt/bitnami/erpnext/venv/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/bitnami/erpnext/venv/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/bitnami/erpnext/venv/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/opt/bitnami/erpnext/bench/bench/commands/utils.py", line 41, in restart
    Bench(".").reload(web, supervisor, systemd)
  File "/opt/bitnami/erpnext/bench/bench/utils/render.py", line 126, in wrapper_fn
    return fn(*args, **kwargs)
  File "/opt/bitnami/erpnext/bench/bench/bench.py", line 151, in reload
    restart_supervisor_processes(bench_path=self.name, web_workers=web, _raise=_raise)
  File "/opt/bitnami/erpnext/bench/bench/utils/bench.py", line 321, in restart_supervisor_processes
    failure = bench.run(f"{sudo}supervisorctl restart {group}", _raise=_raise)
  File "/opt/bitnami/erpnext/bench/bench/bench.py", line 48, in run
    return exec_cmd(cmd, cwd=cwd or self.cwd, _raise=_raise)
  File "/opt/bitnami/erpnext/bench/bench/utils/__init__.py", line 158, in exec_cmd
    raise CommandFailedError from subprocess.CalledProcessError(return_code, cmd)
bench.exceptions.CommandFailedError

@NCP when I try and bench start it says this error:


bitnami@fishwiki:/opt/bitnami/erpnext/frappe-bench$ bench start
05:40:02 system           | redis_cache.1 started (pid=5649)
05:40:02 system           | redis_socketio.1 started (pid=5650)
05:40:02 system           | redis_queue.1 started (pid=5651)
05:40:02 system           | socketio.1 started (pid=5652)
05:40:02 system           | web.1 started (pid=5653)
05:40:02 system           | schedule.1 started (pid=5654)
05:40:02 system           | worker.1 started (pid=5666)
05:40:02 worker.1         | /bin/sh: 1: cannot create logs/worker.log: Permission denied
05:40:02 system           | worker.1 stopped (rc=2)
05:40:02 system           | sending SIGTERM to redis_cache.1 (pid 5649)
05:40:02 system           | sending SIGTERM to redis_socketio.1 (pid 5650)
05:40:02 system           | sending SIGTERM to redis_queue.1 (pid 5651)
05:40:02 system           | sending SIGTERM to web.1 (pid 5653)
05:40:02 system           | sending SIGTERM to socketio.1 (pid 5652)
05:40:02 system           | sending SIGTERM to schedule.1 (pid 5654)
05:40:02 system           | socketio.1 stopped (rc=-15)
05:40:02 system           | redis_cache.1 stopped (rc=-15)
05:40:02 system           | schedule.1 stopped (rc=-15)
05:40:02 system           | redis_socketio.1 stopped (rc=-15)
05:40:02 system           | redis_queue.1 stopped (rc=-15)
05:40:02 system           | web.1 stopped (rc=-15)
bitnami@fishwiki:/opt/bitnami/erpnext/frappe-bench$

And if I run with root, it says error with ports.

Please help, thanks.