Web Form: Options must be a valid DocType for field Payment Gateway in row 63

This happens when trying to setup ERPNext for the first time.

I am trying to setup using these apps

  • ERPNext
  • HRMS

After I try to rerun again bench --site development.localhost migrate it works.

Updating customizations for Web Form
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/workspace/development/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 114, in <module>
    main()
  File "/workspace/development/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 20, in main
    click.Group(commands=commands)(prog_name="bench")
  File "/workspace/development/frappe-bench/env/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspace/development/frappe-bench/env/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/workspace/development/frappe-bench/env/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspace/development/frappe-bench/env/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspace/development/frappe-bench/env/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspace/development/frappe-bench/env/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspace/development/frappe-bench/apps/frappe/frappe/commands/site.py", line 70, in new_site
    _new_site(
  File "/workspace/development/frappe-bench/apps/frappe/frappe/installer.py", line 110, in _new_site
    install_app(app, verbose=verbose, set_as_patched=not source_sql, force=False)
  File "/workspace/development/frappe-bench/apps/frappe/frappe/installer.py", line 316, in install_app
    sync_customizations(name)
  File "/workspace/development/frappe-bench/apps/frappe/frappe/modules/utils.py", line 113, in sync_customizations
    sync_customizations_for_doctype(data, folder, fname)
  File "/workspace/development/frappe-bench/apps/frappe/frappe/modules/utils.py", line 173, in sync_customizations_for_doctype
    validate_fields_for_doctype(doctype)
  File "/workspace/development/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 1179, in validate_fields_for_doctype
    validate_fields(meta)
  File "/workspace/development/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 1617, in validate_fields
    check_link_table_options(meta.get("name"), d)
  File "/workspace/development/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 1254, in check_link_table_options
    frappe.throw(
  File "/workspace/development/frappe-bench/apps/frappe/frappe/__init__.py", line 589, in throw
    msgprint(
  File "/workspace/development/frappe-bench/apps/frappe/frappe/__init__.py", line 561, in msgprint
    _raise_exception()
  File "/workspace/development/frappe-bench/apps/frappe/frappe/__init__.py", line 512, in _raise_exception
    raise exc
frappe.core.doctype.doctype.doctype.WrongOptionsDoctypeLinkError: Web Form: Options must be a valid DocType for field Payment Gateway in row 63

Check the payment gateway field in the webform field and check the option field

Okay found the issue. Seems like it’s a bug in my Custom App. I have exported customizations in <APP>/doctype/custom/web_form.js and when migrating it throws the error. It’s a customization that has been here since 2016-2017 ERPNext V7 if i remember correctly.