Error when creating new site

Hello.

I’m trying to create a new site.

bench new-site library

I get the following error

Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, 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/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 79, in <module>
    main()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 16, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands.py", line 69, in new_site
    _new_site(db_name, site, mariadb_root_username=mariadb_root_username, mariadb_root_password=mariadb_root_password, admin_password=admin_password, verbose=verbos
e, install_apps=install_app, source_sql=source_sql, force=force)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands.py", line 87, in _new_site
    install_db(root_login=mariadb_root_username, root_password=mariadb_root_password, db_name=db_name, admin_password=admin_password, verbose=verbose, source_sql=so
urce_sql,force=force, reinstall=reinstall)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/installer.py", line 31, in install_db
    create_database_and_user(force, verbose)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/installer.py", line 53, in create_database_and_user
    raise Exception("Database %s already exists" % (db_name,))
Exception: Database c5083e213f already exists

It looks like it’s trying to create a database name with an already existing database name.

c5083e213f

Is this a known bug?

Hi!

Did you create previously another site called ‘library’ also?

Yup.

But I deleted it the site. @frahergal

Is there a “proper” way by fully removing the site so that this issue won’t happen?

You can do it manually for now, I think there is not a bench command yet to make it automatically.

Here you can find the steps how to do it:

bench drop-site sitename :wink:

3 Likes

Hello.

I just used that command bench drop-site sitename and my database from my other site got wiped out, gladly I had a backup, but my files where completely lost. :crying_cat_face:

Didn’t you ask to remove the site?

Anyway the site that was deleted will be available in the folder called archived-sites within frappe-bench

Yeah.

I had two sites.

test-site-a 
test-site-b

I did a bench drop-site test-site-a

Then, tried to login to test-site-b and the data was gone, quotes, customers and a lot of information was lost, even though I did a bench backup after performing the bench drop-site command.

Strange. I’ve done bench drop-site almost every week and have about 10 sites. Never had the problem. Could be a bug we should dig into. Was your test-site-b the default site?

Yes.

test-site-b was/is site1.local