Error Migrating from v12 to v13

Hi,

I am trying to migrate from v12 to v13 but i am getting error as frappe.exceptions.ValidatioExecuting erpnext.patches.v13_0.setup_fields_for_80g_certificate_and_donation in (_42ecbef9f7de5751)

Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/opt/bench/erpnext/apps/frappe/frappe/utils/bench_helper.py", line 104, in <module>
    main()
  File "/opt/bench/erpnext/apps/frappe/frappe/utils/bench_helper.py", line 18, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/opt/bench/erpnext/env/lib/python3.8/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/opt/bench/erpnext/env/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/opt/bench/erpnext/env/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/bench/erpnext/env/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/bench/erpnext/env/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/bench/erpnext/env/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/opt/bench/erpnext/env/lib/python3.8/site-packages/click/decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/opt/bench/erpnext/apps/frappe/frappe/commands/__init__.py", line 26, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/opt/bench/erpnext/apps/frappe/frappe/commands/site.py", line 457, in migrate
    migrate(
  File "/opt/bench/erpnext/apps/frappe/frappe/migrate.py", line 68, in migrate
    frappe.modules.patch_handler.run_all(skip_failing)
  File "/opt/bench/erpnext/apps/frappe/frappe/modules/patch_handler.py", line 36, in run_all
    run_patch(patch)
  File "/opt/bench/erpnext/apps/frappe/frappe/modules/patch_handler.py", line 25, in run_patch
    if not run_single(patchmodule = patch):
  File "/opt/bench/erpnext/apps/frappe/frappe/modules/patch_handler.py", line 66, in run_single
    return execute_patch(patchmodule, method, methodargs)
  File "/opt/bench/erpnext/apps/frappe/frappe/modules/patch_handler.py", line 86, in execute_patch
    frappe.get_attr(patchmodule.split()[0] + ".execute")()
  File "/opt/bench/erpnext/apps/erpnext/erpnext/patches/v13_0/setup_fields_for_80g_certificate_and_donation.py", line 8, in execute
    make_custom_fields()
  File "/opt/bench/erpnext/apps/erpnext/erpnext/regional/india/setup.py", line 135, in make_custom_fields
    create_custom_fields(custom_fields, update=update)
  File "/opt/bench/erpnext/apps/frappe/frappe/custom/doctype/custom_field/custom_field.py", line 170, in create_custom_fields
    custom_field.save()
  File "/opt/bench/erpnext/apps/frappe/frappe/model/document.py", line 284, in save
    return self._save(*args, **kwargs)
  File "/opt/bench/erpnext/apps/frappe/frappe/model/document.py", line 338, in _save
    self.run_post_save_methods()
  File "/opt/bench/erpnext/apps/frappe/frappe/model/document.py", line 1010, in run_post_save_methods
    self.run_method("on_update")
  File "/opt/bench/erpnext/apps/frappe/frappe/model/document.py", line 874, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "/opt/bench/erpnext/apps/frappe/frappe/model/document.py", line 1171, in composer
    return composed(self, method, *args, **kwargs)
  File "/opt/bench/erpnext/apps/frappe/frappe/model/document.py", line 1154, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/opt/bench/erpnext/apps/frappe/frappe/model/document.py", line 868, in <lambda>
    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
  File "/opt/bench/erpnext/apps/frappe/frappe/custom/doctype/custom_field/custom_field.py", line 76, in on_update
    validate_fields_for_doctype(self.dt)
  File "/opt/bench/erpnext/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 784, in validate_fields_for_doctype
    validate_fields(meta)
  File "/opt/bench/erpnext/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 1113, in validate_fields
    validate_data_field_type(d)
  File "/opt/bench/erpnext/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 1059, in validate_data_field_type
    frappe.msgprint(text_str + df_options_str, title="Invalid Data Field", raise_exception=True)
  File "/opt/bench/erpnext/apps/frappe/frappe/__init__.py", line 425, in msgprint
    _raise_exception()
  File "/opt/bench/erpnext/apps/frappe/frappe/__init__.py", line 381, in _raise_exception
    raise ValidationError(msg)
frappe.exceptions.ValidationError: <strong>Employee Number</strong> is an invalid Data field.<br><br>Only Options allowed for Data field are:<br><ul><li>Email</li><li>Name</li><li>Phone</li><li>URL</li><li>Barcode</ul>
nError: <strong>Employee Number</strong> is an invalid Data field.

Tried

  1. bench update --build
    Getting database or site-config.json corrupted error
  2. Removed Employee number as not mandatory from v12 instance and restored DB in v13 - still error is the same

Please help on how to resolve this issue ?

During bench migrate, i am getting error as

try bench (migrate --skip-failing) . this will skip the validation error

Yes i did bench migrate --skip-failing and then bench update --build to start the instance

I am getting another error

remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
From https://github.com/frappe/frappe
 * branch                  version-13 -> FETCH_HEAD
WARN: shallow_clone is set in your bench config.
However without passing the --reset flag, your repositories will be unshallowed.
To avoid this, cancel this operation and run `bench update --reset`.

Consider the consequences of `git reset --hard` on your apps before you run that.
To avoid seeing this warning, set shallow_clone to false in your common_site_config.json

Backing up sites...
Backup failed for Site newerp.erpnext.com. Database or site_config.json may be corrupted ```

How to resolve again?

@Moin try:
1 -check the sites/site_name/private/backups . folder and empty it . (check for invisible folders as well like git repositories , use ls -a) .
2 - check the common_site_config.json and site_config.json for any syntax errors .
3 - or just skip the backup while updating using (bench update no-backup )

@bahaou

  1. Emptied the private/backups folder and tried bench update
    same error like - Backup failed for Site example.com . Database or site_config.json may be corrupted
  2. there is no syntax errors,as i rechecked each line
  3. I am in my erpnext bench folder, tried bench update no-backup
bench update no-backup
Usage: bench update [OPTIONS]
Try "bench update --help" for help.

Error: Got unexpected extra argument (no-backup)

Getting an error for this command bench update no-backup ,kindly help on the same

bench update --build --no-backup

@Moin oh I m sorry , as the gentleman said , it’s --no-backup

Thank you so much, but after executing this command. Few dependencies were asked so installed from this command bench setup requirements --node

But error is appearing still

Tracelogs

bench update --build --no-backup
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
From https://github.com/frappe/frappe
 * branch                  version-13 -> FETCH_HEAD
WARN: shallow_clone is set in your bench config.
However without passing the --reset flag, your repositories will be unshallowed.
To avoid this, cancel this operation and run `bench update --reset`.

Consider the consequences of `git reset --hard` on your apps before you run that.
To avoid seeing this warning, set shallow_clone to false in your common_site_config.json

Building assets...
Retrieving assets...

✔ Downloaded Frappe assets from https://github.com/frappe/frappe/releases/download/v13.18.0/assets.tar.gz

Extracting assets...

✔ Restored js/frappe-web.min.js
✔ Restored js/web_form.min.js
✔ Restored js/frappe-recorder.min.js
✔ Restored js/form.min.js
✔ Restored js/frappe-recorder.min.js.map
✔ Restored js/libs.min.js
✔ Restored js/data_import_tools.min.js
✔ Restored js/bootstrap-4-web.min.js.map
✔ Restored js/desk.min.js
✔ Restored js/dialog.min.js.map
✔ Restored js/user_profile_controller.min.js
✔ Restored js/control.min.js.map
✔ Restored js/user_profile_controller.min.js.map
✔ Restored js/desk.min.js.map
✔ Restored js/barcode_scanner.min.js
✔ Restored js/checkout.min.js.map
✔ Restored js/list.min.js
✔ Restored js/bootstrap-4-web.min.js
✔ Restored js/control.min.js
✔ Restored js/dialog.min.js
✔ Restored js/web_form.min.js.map
✔ Restored js/frappe-web.min.js.map
✔ Restored js/moment-bundle.min.js
✔ Restored js/data_import_tools.min.js.map
✔ Restored js/form.min.js.map
✔ Restored js/barcode_scanner.min.js.map
✔ Restored js/checkout.min.js
✔ Restored js/report.min.js
✔ Restored js/list.min.js.map
✔ Restored js/report.min.js.map
✔ Restored css/email.css
✔ Restored css/desk.min.css
✔ Restored css/printview.css
✔ Restored css/frappe-web-b4.css
✔ Restored css/rollup.manifest.css
✔ Restored css/web_form.css
✔ Restored css/report.min.css
✔ Restored css/login.css
✔ Restored css-rtl/email.css
✔ Restored css-rtl/desk.min.css
✔ Restored css-rtl/printview.css
✔ Restored css-rtl/frappe-web-b4.css
✔ Restored css-rtl/web_form.css
✔ Restored css-rtl/report.min.css
✔ Restored css-rtl/login.css
✔ Application Assets Linked

yarn run v1.22.17
$ FRAPPE_ENV=production node rollup/build.js --skip_frappe
Production mode
✔ Built js/moment-bundle.min.js
✔ Built js/libs.min.js
(node:103520) UnhandledPromiseRejectionWarning: TypeError: vue.default is not a function
    at get_rollup_options_for_js (/opt/bench/erpnext/apps/frappe/rollup/config.js:53:14)
    at get_rollup_options (/opt/bench/erpnext/apps/frappe/rollup/config.js:30:10)
    at /opt/bench/erpnext/apps/frappe/rollup/config.js:216:5
    at Array.map (<anonymous>)
    at get_options_for (/opt/bench/erpnext/apps/frappe/rollup/config.js:200:4)
    at build_assets (/opt/bench/erpnext/apps/frappe/rollup/build.js:86:18)
    at /opt/bench/erpnext/apps/frappe/rollup/build.js:61:30
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:103520) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:103520) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Done in 1.64s.
________________


How to resolve this again ?

@Moin do you have data in your app ? are you willing to reset the database ? a fresh installation would be better in this case .

bench update --requirements --no-backup

It updated the requirements, but still it is the same vue default error



bench update --requirements --no-backup
remote: Enumerating objects: 55, done.
remote: Counting objects: 100% (44/44), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 7 (delta 5), reused 5 (delta 3), pack-reused 0
Unpacking objects: 100% (7/7), 1.45 KiB | 114.00 KiB/s, done.
From https://github.com/frappe/frappe
 * branch                  version-13 -> FETCH_HEAD
 + fa6da72b01...e263789156 version-13 -> upstream/version-13  (forced update)
WARN: shallow_clone is set in your bench config.
However without passing the --reset flag, your repositories will be unshallowed.
To avoid this, cancel this operation and run `bench update --reset`.

Consider the consequences of `git reset --hard` on your apps before you run that.
To avoid seeing this warning, set shallow_clone to false in your common_site_config.json

Setting up requirements...
$ /opt/bench/erpnext/env/bin/python -m pip install --quiet --upgrade pip
Installing 2 applications...
Installing frappe
$ /opt/bench/erpnext/env/bin/python -m pip install --quiet --upgrade -e /opt/bench/erpnext/apps/frappe
$ yarn install
yarn install v1.22.17
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning " > bootstrap@4.5.0" has unmet peer dependency "popper.js@^1.16.0".
warning "rollup-plugin-vue > @vue/component-compiler@3.6.0" has unmet peer dependency "postcss@>=6.0".
warning Workspaces can only be enabled in private projects.
[4/4] Building fresh packages...
success Saved lockfile.
$ yarn run snyk-protect
yarn run v1.22.17
$ snyk protect
Successfully applied Snyk patches

Done in 9.29s.
Done in 40.56s.
$ bench build --app frappe
✔ Application Assets Linked

yarn run v1.22.17
$ FRAPPE_ENV=production node rollup/build.js --app frappe
Production mode
✔ Built js/moment-bundle.min.js
✔ Built js/libs.min.js
/opt/bench/erpnext/apps/frappe/rollup/config.js:53
                vue.default(),
                           ^

TypeError: vue.default is not a function
    at get_rollup_options_for_js (/opt/bench/erpnext/apps/frappe/rollup/config.js:53:14)
    at get_rollup_options (/opt/bench/erpnext/apps/frappe/rollup/config.js:30:10)
    at /opt/bench/erpnext/apps/frappe/rollup/config.js:216:5
    at Array.map (<anonymous>)
    at get_options_for (/opt/bench/erpnext/apps/frappe/rollup/config.js:200:4)
    at build_assets (/opt/bench/erpnext/apps/frappe/rollup/build.js:86:18)
    at build_assets_for_app (/opt/bench/erpnext/apps/frappe/rollup/build.js:66:9)
    at Object.<anonymous> (/opt/bench/erpnext/apps/frappe/rollup/build.js:47:2)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
    at internal/main/run_main_module.js:17:47
error Command failed with exit code 1.

I did install the whole erpnext 3-4 times but no luck

I always prefer resolving the issue rather going for --skip-failing because it will eventually throw an error at some point of your daily operations.

To resolve this issue, you need to remove the Employee Number from options field since the Data field can only take options such as Email, Name, Phone, URL, Barcode.

To remove it, you need to access your MariaDB and check which field with fieldtype as Data has options Employee Number
one of the ways of checking this would be to search in the custom field table.

You can run MySQL query
Select name,options from tabCustom Field where fieldtype='Data'; to find out which field is causing the error and then update the options as NULL

Thank you everyone who helped me,

I change the employee ID thing from mysql to none

and instance is now started…Thanks again