Bench update issue -error 1054

Hi All,

Try to upgrade erpnext version to the lates version.

Now my version:

ubuntu@ip-172-31-20-163:/home/frappe/frappe-bench$ bench version
erpnext 8.0.44
frappe 8.0.64

But the web show error code 503.

Here is the error message when I run bench update:

Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 79, in <module>
    main()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 16, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/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 24, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py", line 214, in migrate
    migrate(context.verbose, rebuild_website=rebuild_website)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py", line 31, in migrate
    frappe.modules.patch_handler.run_all()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 29, in run_all
    if not run_single(patchmodule = patch):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 63, in run_single
    return execute_patch(patchmodule, method, methodargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 83, in execute_patch
    frappe.get_attr(patchmodule.split()[0] + ".execute")()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/patches/v8_0/update_desktop_icons.py", line 25, in execute
    where name='{name}'""".format(report_name=report_name, name=icon.get("name")))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/database.py", line 149, in sql
    self._cursor.execute(query)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 250, in execute
    self.errorhandler(self, exc, value)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 42, in defaulterrorhandler
    raise errorvalue
_mysql_exceptions.OperationalError: (1054, "Unknown column '_report' in 'field list'")

Thanks your kindly help.

Error:
"Unknown column ‘_report’ in ‘field list’

take a backup and then bench --site site_name reinstall
then bench update

Hi MCD-50,

Thanks, look like bench site reinstall is successful, the run bench update didnt get any error message. But in web site got error like below.

Thanks again.

Try a hard refresh or bench clear-cache

Thanks.

After bench clear-cache still get error (1054, “Unknown column ‘_report’ in ‘field list’”).

Hi @hellorachel. Please reinstall your site again

Thanks,

Still get same error. Here is my steps,

ubuntu@ip-172-31-20-163:/home/frappe/frappe-bench$ sudo bench --site 127.0.0.1 reinstall
This will wipe your database. Are you sure you want to reinstall? [y/N]: y
Installing frappe...
Updating DocTypes for frappe        : [========================================]
Updating country info               : [========================================]
Set Administrator password: 
Re-enter Administrator password: 
Installing erpnext...
Updating DocTypes for erpnext       : [========================================]
*** Scheduler is disabled ***
ubuntu@ip-172-31-20-163:/home/frappe/frappe-bench$ bench --site all clear-cache
ubuntu@ip-172-31-20-163:/home/frappe/frappe-bench$ 

bench --site site_name migrate

Thanks,

ubuntu@ip-172-31-20-163:/home/frappe/frappe-bench$ bench --site 127.0.0.1 migrate
Migrating 127.0.0.1
Updating DocTypes for frappe        : [========================================]
Updating DocTypes for erpnext       : [========================================]
Syncing help database...

Then use chrome private window to open website, still get same error.

Hi All

I move backup sql and restore to another server (version erpnext 8.0.44 frappe 8.0.64 ), get the same error. Before move it the server is work fine, Is this issue coming from db? Have any other method to resolve it?

Thanks

Hi @hellorachel,
Yes, the issue is coming because of the database. It seems like your database isn’t migrated properly.
So the best possible method to resolve this is to save the doctype named “Desktop Icon”. When you save this doctype then the field ‘_report’ will be synced with the database. and you will not get this issue anymore. After that, you can also run this patch in order to work things properly.(same patch which caused you problem initially)

Hi ManasSolanki

Thanks your help. I have a question about the save the doctype named “Desktop Icon” this method. Actually I can not go to desktop, its blank page now. Should I run patch directly now?

Thanks again

Hi,
Yeah, you should run this patch again if that’s not executed properly in your last bench migration.

Hi,

Really appreciate your replay, I try to use python update_desktop_icons.py directly, but get another error. No module named frappe. Is my command wrong?

frappe@ip-172-31-20-163:~/frappe-bench/apps/frappe/frappe/patches/v8_0$ python update_desktop_icons.py 
Traceback (most recent call last):
  File "update_desktop_icons.py", line 5, in <module>
    import frappe
ImportError: No module named frappe

You can use the following commands:

bench --site <site-name> execute frappe.patches.v8_0.update_desktop_icons.execute

Note: There is possibility that you may get errors because ideally every patch should be executed only once. But you can try this, it will not cause any damage.

Hi,

Thanks. I got the same error.

ubuntu@ip-172-31-20-163:/home/frappe/frappe-bench$ bench --site 127.0.0.1 execute frappe.patches.v8_0.update_desktop_icons.execute
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 79, in <module>
    main()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 16, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/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 24, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/utils.py", line 111, in execute
    ret = frappe.get_attr(method)(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/patches/v8_0/update_desktop_icons.py", line 25, in execute
    where name='{name}'""".format(report_name=report_name, name=icon.get("name")))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/database.py", line 149, in sql
    self._cursor.execute(query)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 250, in execute
    self.errorhandler(self, exc, value)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 42, in defaulterrorhandler
    raise errorvalue
_mysql_exceptions.OperationalError: (1054, "Unknown column '_report' in 'field list'")

Did you save the doctype “Desktop Icon” before running this patch?

Sorry I dont know how to save “Desktop Icon”. Because I can not access desktop now. Have other way can save it?

You can use the following command before running that patch, this will sync all the doctypes:

bench --site <site-name> execute frappe.model.sync.sync_all

Hi,

Thanks your kindly help. Here is my step. Still stuck in same error.

ubuntu@ip-172-31-20-163:/home/frappe/frappe-bench$ bench --site 127.0.0.1 execute frappe.model.sync.sync_all
Updating DocTypes for frappe        : [========================================]
Updating DocTypes for erpnext       : [========================================]
ubuntu@ip-172-31-20-163:/home/frappe/frappe-bench$ bench --site 127.0.0.1 execute frappe.patches.v8_0.update_desktop_icons.execute
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 79, in <module>
    main()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 16, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/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 24, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/utils.py", line 111, in execute
    ret = frappe.get_attr(method)(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/patches/v8_0/update_desktop_icons.py", line 25, in execute
    where name='{name}'""".format(report_name=report_name, name=icon.get("name")))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/database.py", line 149, in sql
    self._cursor.execute(query)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 250, in execute
    self.errorhandler(self, exc, value)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 42, in defaulterrorhandler
    raise errorvalue
_mysql_exceptions.OperationalError: (1054, "Unknown column '_report' in 'field list'")