frappe.exceptions.ValidationError: Search field my_custom_field is not valid

Getting error frappe.exceptions.ValidationError: Search field property_unit is not valid

Can’t figure out how to get to the root cause. Will appreciate for pointers to find out more details on why this error occurs. I checked the custom_field.json (from fixtures directory) but couldn’t find any field there.

File “/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py”, line 43, in migrate
sync_fixtures()
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/fixtures.py”, line 24, in sync_fixtures
ignore_links=True, overwrite=True)
File “/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/data_import/data_import.py”, line 54, 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/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 65, in import_file_by_path
ignore_version=ignore_version, reset_permissions=reset_permissions)
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 133, in import_doc
doc.insert()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 248, in insert
self.run_post_save_methods()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 915, in run_post_save_methods
self.run_method(“on_update”)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 780, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1058, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1041, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 774, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/custom/doctype/custom_field/custom_field.py”, line 60, in on_update
validate_fields_for_doctype(self.dt)
File “/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py”, line 483, in validate_fields_for_doctype
validate_fields(frappe.get_meta(doctype, cached=False))
File “/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py”, line 727, in validate_fields
check_search_fields(meta, fields)
File “/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py”, line 620, in check_search_fields
frappe.throw(_(“Search field {0} is not valid”).format(fieldname))
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 339, in throw
msgprint(msg, raise_exception=exc, title=title, indicator=‘red’)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 325, in msgprint
_raise_exception()
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 298, in _raise_exception
raise raise_exception(msg)
frappe.exceptions.ValidationError: Search field property_unit is not valid

@aakvatech how did you solved this?

Had to remove the field name from search field in the doctype

Alternatively to add a field into the doctype to get this moving.

Where are you getting this error?

I am getting this error with another field, but it seems it happens the new do modifications to doctype, I have uninstall an add-on app we did to get this solve

Hi @aakvatech. I am also getting similar error type frappe.exceptions.ValidationError: Customer field is not valid

I moved db from V10 to V12. It connected but after 1st time bench update I got this error. And now site is Your system is being updated. Please refresh again after a few moments state.

How did you fix this issue? I can’t login to site now. Can only SSH. Thanks.

Restart bench and do bench update again if required.

Did that, no luck. Not sure why it worked 1st time. I copied db from my V10 instance to V12. Was able to compare Customer, supplier and financial between both through UI. After that bench update is throwing up error. Don’t have any custom app or customization except for print format.

Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/web9t9/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 99, in <module>
    main()
  File "/home/web9t9/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 18, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/home/web9t9/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/web9t9/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/web9t9/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/web9t9/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/web9t9/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/web9t9/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/web9t9/frappe-bench/env/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/web9t9/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 26, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/web9t9/frappe-bench/apps/frappe/frappe/commands/site.py", line 287, in migrate
    migrate(context.verbose, rebuild_website=rebuild_website, skip_failing=skip_failing)
  File "/home/web9t9/frappe-bench/apps/frappe/frappe/migrate.py", line 53, in migrate
    sync_customizations()
  File "/home/web9t9/frappe-bench/apps/frappe/frappe/modules/utils.py", line 96, in sync_customizations
    sync_customizations_for_doctype(data, folder)
  File "/home/web9t9/frappe-bench/apps/frappe/frappe/modules/utils.py", line 152, in sync_customizations_for_doctype
    validate_fields_for_doctype(doctype)
  File "/home/web9t9/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 672, in validate_fields_for_doctype
    validate_fields(frappe.get_meta(doctype, cached=False))
  File "/home/web9t9/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 980, in validate_fields
    check_search_fields(meta, fields)
  File "/home/web9t9/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 834, in check_search_fields
    frappe.throw(_("Search field {0} is not valid").format(fieldname))
  File "/home/web9t9/frappe-bench/apps/frappe/frappe/__init__.py", line 376, in throw
    msgprint(msg, raise_exception=exc, title=title, indicator='red', is_minimizable=is_minimizable)
  File "/home/web9t9/frappe-bench/apps/frappe/frappe/__init__.py", line 355, in msgprint
    _raise_exception()
  File "/home/web9t9/frappe-bench/apps/frappe/frappe/__init__.py", line 315, in _raise_exception
    raise raise_exception(msg)
frappe.exceptions.ValidationError: Search field customer is not valid

Anything before this?

The site started working after I did bench set-maintenance-mode off

Keep getting this error on bench update --reset or bench migrate

I edited the trackback in earlier post. Nothing was missed. Its all after running the commands.