Error when creating new site


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/", line 162, 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/frappe/frappe-bench/apps/frappe/frappe/utils/", line 79, in <module>
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/", line 16, in main
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/", line 696, in main
    rv = self.invoke(ctx)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/", 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/", 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/", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/", 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/", 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/", line 31, in install_db
    create_database_and_user(force, verbose)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/", 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.


Is this a known bug?


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


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:



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


I had two sites.


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?


test-site-b was/is site1.local