Getting "Search Fields should contain valid fieldnames" message for Cost Center doctype

Hi There,

I am getting “Search Fields should contain valid fieldnames” message when I click on Update on Customize Form page for Cost Center doctype. I did create an issue Bug : Search Fields should contain valid fieldnames · Issue #2441 · frappe/erpnext · GitHub but didn’t get a valid response. In search field, it has “name,parent_cost_center”. In web console log it has:
"“Traceback (innermost last):
File “/home/doris/frappe-bench/apps/frappe/frappe/app.py”, line 49, in application
response = frappe.handler.handle()
File “/home/doris/frappe-bench/apps/frappe/frappe/handler.py”, line 66, in handle
execute_cmd(cmd)
File “/home/doris/frappe-bench/apps/frappe/frappe/handler.py”, line 89, in execute_cmd
ret = frappe.call(method, **frappe.form_dict)
File “/home/doris/frappe-bench/apps/frappe/frappe/init.py”, line 531, in call
return fn(*args, **newargs)
File “/home/doris/frappe-bench/apps/frappe/frappe/handler.py”, line 19, in runserverobj
frappe.widgets.form.run_method.runserverobj(method, docs=docs, dt=dt, dn=dn, arg=arg, args=args)
File “/home/doris/frappe-bench/apps/frappe/frappe/widgets/form/run_method.py”, line 35, in runserverobj
r = doc.run_method(method)
File “/home/doris/frappe-bench/apps/frappe/frappe/model/document.py”, line 412, in run_method
return Document.hook(fn)(self, *args, **kwargs)
File “/home/doris/frappe-bench/apps/frappe/frappe/model/document.py”, line 493, in composer
return composed(self, method, *args, **kwargs)
File “/home/doris/frappe-bench/apps/frappe/frappe/model/document.py”, line 476, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/doris/frappe-bench/apps/frappe/frappe/model/document.py”, line 406, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/doris/frappe-bench/apps/frappe/frappe/core/doctype/customize_form/customize_form.py”, line 93, in save_customization
validate_fields_for_doctype(self.doc_type)
File “/home/doris/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py”, line 178, in validate_fields_for_doctype
validate_fields(frappe.get_meta(doctype))
File “/home/doris/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py”, line 280, in validate_fields
check_search_fields(meta)
File “/home/doris/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py”, line 262, in check_search_fields
frappe.throw(_(“Search Fields should contain valid fieldnames”))
File “/home/doris/frappe-bench/apps/frappe/frappe/init.py”, line 202, in throw
msgprint(msg, raise_exception=exc)
File “/home/doris/frappe-bench/apps/frappe/frappe/init.py”, line 199, in msgprint
_raise_exception()
File “/home/doris/frappe-bench/apps/frappe/frappe/init.py”, line 183, in _raise_exception
raise raise_exception, msg
ValidationError: Search Fields should contain valid fieldnames”

Please help to rectify this. Because of this I am not able to set permission for Cost Center doc type.

Kind regards,
Mayur

Check the “Search Fields” property in your Cost Center DocType (or via Customize Form View) if you have customized. One of the fields is no longer a fieldname.

Hi,

I would like to add the ‘parent’ in search field, but getting similar error.
parent column is there in table but not in doctype, so i can’t add it, isn’t it?