Bench update error v12.6 to v12.8

I am getting following error while migrating the site, can anybody help me to get resolved.

frappe@santosh:~/frappe-bench$ bench update --patch
Backing up sites…
Patching sites…
Migrating indipco
Updating DocTypes for frappe : [========================================]
Updating DocTypes for erpnext : [========================================]
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/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 97, in
main()
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 764, in call
return self.main(*args, **kwargs)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 717, in main
rv = self.invoke(ctx)
File “/home/frappe/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/frappe/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/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/home/frappe/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/frappe/frappe-bench/apps/frappe/frappe/commands/init.py”, line 25, in _func
ret = f(frappe.dict(ctx.obj), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py”, line 233, in migrate
migrate(context.verbose, rebuild_website=rebuild_website, skip_failing=skip_failing)
File “/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py”, line 52, 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 56, 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 66, 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 141, in import_doc
doc.insert()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 228, in insert
self.run_before_save_methods()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 886, in run_before_save_methods
self.run_method(“validate”)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 786, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1055, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1038, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 780, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py”, line 72, in validate
validate_fields(self)
File “/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py”, line 830, in validate_fields
check_unique_and_text(meta.get(“name”), d)
File “/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py”, line 659, in check_unique_and_text
frappe.throw(
(“{0}: Fieldtype {1} for {2} cannot be unique”).format(docname, d.fieldtype, d.label), NonUniqueError)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 360, in throw
msgprint(msg, raise_exception=exc, title=title, indicator=‘red’)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 346, in msgprint
_raise_exception()
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 315, in _raise_exception
raise raise_exception(msg)
frappe.core.doctype.doctype.doctype.NonUniqueError: OAuth Authorization Code: Fieldtype Text for Authorization Code cannot be unique

A fixture in your indipco custom app fails a validity check that you report as an issue site migrate with custom app error · Issue #18875 · frappe/erpnext · GitHub

To find the problem fixture maybe run bench export-fixtures

2 Likes

Thanks Clarkej, I have re-configured for fixtures and exported them, migration was successful.

Installed Apps

ERPNext: v13.0.0-dev (rebrand-ui)
Frappe Framework: v13.0.0-dev (rebrand-ui)
myerp: v0.0.1 (master)
image
I have not made anything customized in the doctype : OAuth Authorization Code

the error is OAuth Authorization Code: Fieldtype Text for Authorization Code cannot be unique
I tried.
frappe@vmi417656:~/erpnext$ bench export-fixtures
Exporting DocType app myerp filters None
Exporting Custom Script app myerp filters None
Exporting Custom Field app myerp filters None
Exporting Property Setter app myerp filters None
Exporting Print Format app myerp filters None

still bench update --patch failed with the same error :frowning:
please anyone knows how do I get to resolve? I appreciate your help in advance.

Resolved by the following step.

  1. Removing Doctype from fixtures in hooks.py, and deleting the doctype.json file from the fixtures folder fixed the issue

  2. Switch from version-13 rebrand-ui to version-13-beta

    bench switch-to-branch version-13-beta frappe erpnext --upgrade
    
    sudo bench update --patch
    
  3. New error caught

      pymysql.err.InternalError: (1170, "BLOB/TEXT column 'authorization_code' used in key specification without a key length")
    
  4. Bypass Custom App and sync database

     sudo bench --site test.example.com migrate
     sudo bench clear-cache
     sudo bench build
    

An update fixed this for me

bench update --reset

1 Like