When Creating a new site shows error

Hi all,
I have installed the erpnext in digital ocean and customised that. Now when i create a new site it shows 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
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=verbose, install_apps=install_app, source_sql=source_sql, force=force)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands.py”, line 89, in _new_site
_install_app(“frappe”, verbose=verbose, set_as_patched=not source_sql)
File “/home/frappe/frappe-bench/apps/frappe/frappe/installer.py”, line 134, in install_app
frappe.get_attr(after_install)()
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/install.py”, line 47, in after_install
frappe.get_doc(d).insert()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 184, in insert
self.set_defaults()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 413, in set_defaults
new_doc = frappe.new_doc(self.doctype, as_dict=True)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 510, in new_doc
return get_new_doc(doctype, parent_doc, parentfield, as_dict=as_dict)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/create_new.py”, line 19, in get_new_doc
frappe.local.new_doc_templates[doctype] = make_new_doc(doctype)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/create_new.py”, line 40, in make_new_doc
set_user_and_static_default_values(doc)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/create_new.py”, line 55, in set_user_and_static_default_values
user_default_value = get_user_default_value(df, defaults, user_permissions)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/create_new.py”, line 70, in get_user_default_value
if (frappe.get_meta(df.options).document_type==“Setup”
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 551, in get_meta
return frappe.model.meta.get_meta(doctype, cached=cached)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/meta.py”, line 16, in get_meta
return frappe.cache().hget(“meta”, doctype, lambda: Meta(doctype))
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/redis_wrapper.py”, line 145, in hget
value = generator()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/meta.py”, line 16, in
return frappe.cache().hget(“meta”, doctype, lambda: Meta(doctype))
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/meta.py”, line 48, in init
super(Meta, self).init(“DocType”, doctype)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 79, in init
self.load_from_db()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/meta.py”, line 53, in load_from_db
super(Meta, self).load_from_db()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 110, in load_from_db
frappe.throw(
(“{0} {1} not found”).format(
(self.doctype), self.name), frappe.DoesNotExistError)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 264, in throw
msgprint(msg, raise_exception=exc)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 257, in msgprint
_raise_exception()
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 242, in _raise_exception
raise raise_exception, encode(msg)
frappe.exceptions.DoesNotExistError: DocType Stores not found
root@advshop-erpnext:/home/frappe/frappe-bench#

The doctype stores has created in the first site site1.local. now i am creating a new site named site2.local

Here i want to Create a new site for some other client what can i do with this.

Seems like you have created a new doctype called “Stores” in any other app. But added a link field in frappe with “Stores” in options. Your custom field should also be part of the custom app.

S nabin… now we can’t create a new site in this droplet…

Remove the custom field from the frappe app and try to create the site.

@nabinhait Thanks for your Reply…

1 Like

@nabinhait

Please how do i remove a custom field. I am trying to run a bench update in my case and i get this error as seen below…

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/ubuntu/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 94, in
main()
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 722, in call
return self.main(*args, **kwargs)
File “/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 697, in main
rv = self.invoke(ctx)
File “/home/ubuntu/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/ubuntu/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/ubuntu/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/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 535, in invoke
return callback(*args, **kwargs)
File “/home/ubuntu/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/ubuntu/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/commands/site.py”, line 222, in migrate
migrate(context.verbose, rebuild_website=rebuild_website)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/migrate.py”, line 31, in migrate
frappe.modules.patch_handler.run_all()
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 29, in run_all
if not run_single(patchmodule = patch):
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 63, in run_single
return execute_patch(patchmodule, method, methodargs)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 83, in execute_patch
frappe.get_attr(patchmodule.split()[0] + “.execute”)()
File “/home/ubuntu/frappe-bench/apps/erpnext/erpnext/patches/v10_0/add_guardian_role_for_parent_portal.py”, line 15, in execute
}).insert(ignore_permissions=True)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py”, line 239, in insert
self.run_method(“after_insert”)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py”, line 755, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py”, line 1024, in composer
return composed(self, method, *args, **kwargs)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py”, line 1007, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py”, line 749, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/core/doctype/role/role.py”, line 19, in after_insert
user.add_roles(self.name)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/core/doctype/user/user.py”, line 378, in add_roles
self.save()
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py”, line 256, in save
return self._save(*args, **kwargs)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py”, line 289, in _save
self.validate_links()
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py”, line 714, in validate_links
invalid_links, cancelled_links = self.get_invalid_links()
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 462, in get_invalid_links
if frappe.get_meta(doctype).issingle:
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/init.py”, line 655, in get_meta
return frappe.model.meta.get_meta(doctype, cached=cached)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/model/meta.py”, line 33, in get_meta
lambda: Meta(doctype))
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/utils/redis_wrapper.py”, line 173, in hget
value = generator()
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/model/meta.py”, line 33, in
lambda: Meta(doctype))
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/model/meta.py”, line 72, in init
super(Meta, self).init(“DocType”, doctype)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py”, line 103, in init
self.load_from_db()
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/model/meta.py”, line 77, in load_from_db
super(Meta, self).load_from_db()
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py”, line 140, in load_from_db
frappe.throw(
(“{0} {1} not found”).format(
(self.doctype), self.name), frappe.DoesNotExistError)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/init.py”, line 323, in throw
msgprint(msg, raise_exception=exc, title=title, indicator=‘red’)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/init.py”, line 309, in msgprint
_raise_exception()
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/init.py”, line 282, in _raise_exception
raise raise_exception(encode(msg))
frappe.exceptions.DoesNotExistError: DocType Store not found

Run the following and share the output:

bench --site <your-site-name> mysql
select name, dt, fieldname, options from `tabCustom Field` where options = 'Store';

@nabinhait

image

Run the following to delete the custom field.

bench --site <your-site-name> mysql
delete from `tabCustom Field` where options = 'Store';

and then try to update again.

Thank you @nabinhait

here is another error log below…How do i fix as well

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/ubuntu/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 94, in
main()
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 722, in call
return self.main(*args, **kwargs)
File “/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 697, in main
rv = self.invoke(ctx)
File “/home/ubuntu/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/ubuntu/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/ubuntu/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/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 535, in invoke
return callback(*args, **kwargs)
File “/home/ubuntu/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/ubuntu/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
ret = f(frappe.dict(ctx.obj), *args, **kwargs)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/commands/site.py”, line 222, in migrate
migrate(context.verbose, rebuild_website=rebuild_website)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/migrate.py”, line 35, in migrate
sync_fixtures()
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/utils/fixtures.py”, line 24, in sync_fixtures
ignore_links=True, overwrite=True)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/core/doctype/data_import/data_import.py”, line 50, in import_doc
frappe.modules.import_file.import_file_by_path(f, data_import=True, force=True, pre_process=pre_process, reset_permissions=True)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 58, in import_file_by_path
ignore_version=ignore_version, reset_permissions=reset_permissions)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 132, in import_doc
doc.insert()
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py”, line 245, in insert
self.run_post_save_methods()
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py”, line 887, in run_post_save_methods
self.run_method(“on_update”)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py”, line 755, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py”, line 1024, in composer
return composed(self, method, *args, **kwargs)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py”, line 1007, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py”, line 749, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/custom/doctype/custom_field/custom_field.py”, line 51, in on_update
validate_fields_for_doctype(self.dt)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py”, line 389, in validate_fields_for_doctype
validate_fields(frappe.get_meta(doctype, cached=False))
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py”, line 630, in validate_fields
check_link_table_options(d)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py”, line 435, in check_link_table_options
frappe.throw(
(“Options must be a valid DocType for field {0} in row {1}”).format(d.label, d.idx))
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/init.py”, line 323, in throw
msgprint(msg, raise_exception=exc, title=title, indicator=‘red’)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/init.py”, line 309, in msgprint
_raise_exception()
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/init.py”, line 282, in _raise_exception
raise raise_exception(encode(msg))
frappe.exceptions.ValidationError: Options must be a valid DocType for field Payment Method in row 93

This is also related to some customization.

Try to find the custom field where the field label is “Payment Method” and what is the options there.

Thank you @nabinhait this is sorted