Bench update error erpnext v7

Hi everyone,

i got following error when trying to execute # bench update
Please advise how to fix this issue.

Thanks a lot.

frappe@pink:~/frappe-bench$ bench update
INFO:bench.utils:updating bench
remote: Counting objects: 48, done.
remote: Compressing objects: 100% (17/17), done.
remote: Total 48 (delta 35), reused 41 (delta 28), pack-reused 0
Unpacking objects: 100% (48/48), done.
From https://github.com/frappe/bench
   14215b8..3fe7392  master     -> origin/master
Updating 14215b8..3fe7392
Fast-forward
 README.md                                                | 18 +++++++++---------
 bench/cli.py                                             |  2 +-
 bench/commands/setup.py                                  | 14 ++++++++++++--
 bench/config/lets_encrypt.py                             | 43 ++++++++++++++++++++++++++++++-------------
 bench/utils.py                                           |  9 ++++++++-
 playbooks/develop/centos.yml                             |  3 +--
 playbooks/develop/debian.yml                             |  3 +--
 playbooks/develop/includes/wkhtmltopdf.yml               | 19 +++++++++++++++++++
 playbooks/develop/includes/wkhtmltopdf_centos.yml        | 12 ------------
 playbooks/develop/includes/wkhtmltopdf_ubuntu_debian.yml | 28 ----------------------------
 playbooks/develop/ubuntu.yml                             |  3 +--
 playbooks/install.py                                     | 11 ++++-------
 playbooks/production/setup_firewall.yml                  | 43 +++++++++++++++++++++++++++++++++++++++++++
 vm/ansible/roles/wkhtmltopdf/defaults/main.yml           |  2 +-
 vm/ansible/roles/wkhtmltopdf/tasks/main.yml              | 19 +++++++------------
 15 files changed, 137 insertions(+), 92 deletions(-)
 mode change 100644 => 100755 bench/cli.py
 mode change 100644 => 100755 bench/commands/setup.py
 create mode 100644 playbooks/develop/includes/wkhtmltopdf.yml
 delete mode 100644 playbooks/develop/includes/wkhtmltopdf_centos.yml
 delete mode 100644 playbooks/develop/includes/wkhtmltopdf_ubuntu_debian.yml
 create mode 100755 playbooks/production/setup_firewall.yml
remote: Counting objects: 80, done.
remote: Compressing objects: 100% (26/26), done.
remote: Total 80 (delta 66), reused 68 (delta 54), pack-reused 0
Unpacking objects: 100% (80/80), done.
From https://github.com/frappe/frappe
   ecfb630..77af845  develop    -> upstream/develop
Requirement already satisfied (use --upgrade to upgrade): Pillow in ./env/lib/python2.7/site-packages
INFO:bench.app:pulling frappe
From https://github.com/frappe/frappe
 * branch            develop    -> FETCH_HEAD
Updating ecfb630..77af845
Fast-forward
 frappe/core/doctype/doctype/doctype.js                                   | 25 ++++++++++++++++---------
 frappe/core/doctype/doctype/doctype.json                                 |  3 ++-
 frappe/core/doctype/user/test_user.py                                    | 13 +++++++++----
 .../en/guides/app-development/trigger-event-on-deletion-of-grid-row.md   |  7 +++++++
 .../doctype/integration_request/integration_request.json                 | 13 +++++++++++--
 .../doctype/integration_service/integration_service.py                   | 21 ++++++++++++---------
 .../doctype/integration_service/test_integration_service.py              | 10 +++++++++-
 frappe/integrations/doctype/dropbox_settings/dropbox_settings.py         | 30 ++++++++++++++----------------
 frappe/integrations/doctype/razorpay_settings/razorpay_settings.py       | 34 ++++++++++++++++------------------
 frappe/model/base_document.py                                            |  2 ++
 frappe/public/css/report.css                                             | 10 +++++++---
 frappe/public/js/frappe/form/footer/timeline_item.html                   |  2 +-
 frappe/public/js/frappe/ui/filters/filters.js                            |  7 +++++++
 frappe/public/js/lib/Sortable.min.js                                     |  4 ++--
 frappe/public/less/report.less                                           |  9 ++++++---
 frappe/sessions.py                                                       |  3 ++-
 frappe/utils/scheduler.py                                                | 23 +++++++++++++++++++++--
 frappe/website/doctype/web_form/web_form.py                              | 14 +++++++-------
 frappe/website/render.py                                                 |  7 +++++--
 19 files changed, 156 insertions(+), 81 deletions(-)
INFO:bench.app:pulling erpnext
remote: Counting objects: 247, done.
remote: Compressing objects: 100% (82/82), done.
remote: Total 247 (delta 183), reused 227 (delta 164), pack-reused 0
Receiving objects: 100% (247/247), 952.46 KiB | 1.06 MiB/s, done.
Resolving deltas: 100% (183/183), completed with 108 local objects.
From https://github.com/frappe/erpnext
 * branch            develop    -> FETCH_HEAD
   257bbbe..f5be103  develop    -> upstream/develop
Updating 257bbbe..f5be103
Fast-forward
 erpnext/accounts/doctype/journal_entry/journal_entry.py                  |   4 +-
 .../doctype/salary_component_account/salary_component_account.json       |   6 +-
 erpnext/accounts/report/balance_sheet/balance_sheet.py                   |  40 +-
 erpnext/accounts/report/trial_balance/trial_balance.js                   |   5 +
 erpnext/accounts/report/trial_balance/trial_balance.py                   |   6 +-
 erpnext/accounts/utils.py                                                |   2 +-
 erpnext/controllers/stock_controller.py                                  |  16 +-
 erpnext/docs/assets/img/accounts/pos-sales-invoice.png                   | Bin 0 -> 75097 bytes
 erpnext/docs/assets/img/fleet-management/__init__.py                     |   0
 erpnext/docs/assets/img/fleet-management/expense-claim-3.1.png           | Bin 0 -> 31981 bytes
 erpnext/docs/assets/img/fleet-management/expense-claim-3.2.png           | Bin 0 -> 43074 bytes
 erpnext/docs/assets/img/fleet-management/vehicle-1.1.png                 | Bin 0 -> 38571 bytes
 erpnext/docs/assets/img/fleet-management/vehicle-1.2.png                 | Bin 0 -> 53142 bytes
 erpnext/docs/assets/img/fleet-management/vehicle-1.3.png                 | Bin 0 -> 32618 bytes
 erpnext/docs/assets/img/fleet-management/vehicle-expenses.png            | Bin 0 -> 80382 bytes
 erpnext/docs/assets/img/fleet-management/vehicle-log-2.1.png             | Bin 0 -> 36897 bytes
 erpnext/docs/assets/img/fleet-management/vehicle-log-2.2.png             | Bin 0 -> 45559 bytes
 erpnext/docs/assets/img/human-resources/bank-entry.png                   | Bin 0 -> 55981 bytes
 erpnext/docs/assets/img/human-resources/process-payroll.png              | Bin 99435 -> 221019 bytes
 erpnext/docs/assets/img/human-resources/salary-structure-account.png     | Bin 0 -> 27318 bytes
 erpnext/docs/assets/img/human-resources/salary-structure.png             | Bin 236328 -> 423262 bytes
 erpnext/docs/user/manual/en/accounts/sales-invoice.md                    |  14 +-
 erpnext/docs/user/manual/en/fleet_management/__init__.py                 |   0
 erpnext/docs/user/manual/en/fleet_management/index.md                    |  64 +++
 erpnext/docs/user/manual/en/fleet_management/index.txt                   |   3 +
 erpnext/docs/user/manual/en/human-resources/salary-and-payroll.md        |  27 +-
 erpnext/fleet_management/__init__.py                                     |   0
 erpnext/fleet_management/doctype/__init__.py                             |   0
 erpnext/fleet_management/doctype/vehicle/__init__.py                     |   0
 erpnext/fleet_management/doctype/vehicle/test_vehicle.py                 |  24 ++
 erpnext/fleet_management/doctype/vehicle/vehicle.js                      |   8 +
 erpnext/fleet_management/doctype/vehicle/vehicle.json                    | 764 +++++++++++++++++++++++++++++++++
 erpnext/fleet_management/doctype/vehicle/vehicle.py                      |  14 +
 erpnext/fleet_management/doctype/vehicle/vehicle_dashboard.py            |  13 +
 erpnext/fleet_management/doctype/vehicle_log/__init__.py                 |   0
 erpnext/fleet_management/doctype/vehicle_log/test_vehicle_log.py         |  39 ++
 erpnext/fleet_management/doctype/vehicle_log/vehicle_log.js              |  33 ++
 erpnext/fleet_management/doctype/vehicle_log/vehicle_log.json            | 634 +++++++++++++++++++++++++++
 erpnext/fleet_management/doctype/vehicle_log/vehicle_log.py              |  57 +++
 erpnext/fleet_management/doctype/vehicle_service/__init__.py             |   0
 erpnext/fleet_management/doctype/vehicle_service/vehicle_service.json    | 144 +++++++
 erpnext/fleet_management/doctype/vehicle_service/vehicle_service.py      |  10 +
 erpnext/fleet_management/report/__init__.py                              |   0
 erpnext/fleet_management/report/vehicle_expenses/__init__.py             |   0
 erpnext/fleet_management/report/vehicle_expenses/vehicle_expenses.js     |  41 ++
 erpnext/fleet_management/report/vehicle_expenses/vehicle_expenses.json   |  18 +
 erpnext/fleet_management/report/vehicle_expenses/vehicle_expenses.py     |  81 ++++
 erpnext/hr/doctype/employee/employee.js                                  |  18 +
 erpnext/hr/doctype/employee/employee.json                                |  54 ++-
 erpnext/hr/doctype/expense_claim/expense_claim.json                      |  57 ++-
 erpnext/hr/doctype/hr_settings/hr_settings.json                          |   4 +-
 erpnext/hr/doctype/leave_allocation/leave_allocation.js                  |   7 +
 erpnext/hr/doctype/leave_allocation/leave_allocation.py                  |   5 +
 erpnext/hr/doctype/process_payroll/process_payroll.js                    | 109 ++++-
 erpnext/hr/doctype/process_payroll/process_payroll.json                  | 156 +++++--
 erpnext/hr/doctype/process_payroll/process_payroll.py                    | 223 +++++++---
 erpnext/hr/doctype/process_payroll/test_process_payroll.py               |  27 ++
 erpnext/hr/doctype/salary_component/salary_component.json                |  45 +-
 erpnext/hr/doctype/salary_slip/salary_slip.json                          |  55 ++-
 erpnext/hr/doctype/salary_slip/salary_slip.py                            |  42 +-
 erpnext/hr/doctype/salary_slip/test_salary_slip.py                       |   4 +-
 erpnext/hr/doctype/salary_structure/salary_structure.js                  |   1 +
 erpnext/hr/doctype/salary_structure/salary_structure.json                | 107 ++++-
 erpnext/hr/doctype/salary_structure/test_salary_structure.py             |  19 +-
 erpnext/modules.txt                                                      |   1 +
 erpnext/patches.txt                                                      |   3 +
 erpnext/projects/doctype/timesheet/test_timesheet.py                     |   4 +-
 erpnext/public/js/controllers/accounts.js                                |   8 +
 erpnext/setup/install.py                                                 |   5 +-
 erpnext/stock/doctype/material_request_item/material_request_item.json   |   4 +-
 erpnext/stock/doctype/purchase_receipt/purchase_receipt.py               |   8 +-
 71 files changed, 2859 insertions(+), 174 deletions(-)
 create mode 100644 erpnext/docs/assets/img/accounts/pos-sales-invoice.png
 create mode 100644 erpnext/docs/assets/img/fleet-management/__init__.py
 create mode 100644 erpnext/docs/assets/img/fleet-management/expense-claim-3.1.png
 create mode 100644 erpnext/docs/assets/img/fleet-management/expense-claim-3.2.png
 create mode 100644 erpnext/docs/assets/img/fleet-management/vehicle-1.1.png
 create mode 100644 erpnext/docs/assets/img/fleet-management/vehicle-1.2.png
 create mode 100644 erpnext/docs/assets/img/fleet-management/vehicle-1.3.png
 create mode 100644 erpnext/docs/assets/img/fleet-management/vehicle-expenses.png
 create mode 100644 erpnext/docs/assets/img/fleet-management/vehicle-log-2.1.png
 create mode 100644 erpnext/docs/assets/img/fleet-management/vehicle-log-2.2.png
 create mode 100644 erpnext/docs/assets/img/human-resources/bank-entry.png
 create mode 100644 erpnext/docs/assets/img/human-resources/salary-structure-account.png
 create mode 100644 erpnext/docs/user/manual/en/fleet_management/__init__.py
 create mode 100644 erpnext/docs/user/manual/en/fleet_management/index.md
 create mode 100644 erpnext/docs/user/manual/en/fleet_management/index.txt
 create mode 100644 erpnext/fleet_management/__init__.py
 create mode 100644 erpnext/fleet_management/doctype/__init__.py
 create mode 100644 erpnext/fleet_management/doctype/vehicle/__init__.py
 create mode 100644 erpnext/fleet_management/doctype/vehicle/test_vehicle.py
 create mode 100644 erpnext/fleet_management/doctype/vehicle/vehicle.js
 create mode 100644 erpnext/fleet_management/doctype/vehicle/vehicle.json
 create mode 100644 erpnext/fleet_management/doctype/vehicle/vehicle.py
 create mode 100644 erpnext/fleet_management/doctype/vehicle/vehicle_dashboard.py
 create mode 100644 erpnext/fleet_management/doctype/vehicle_log/__init__.py
 create mode 100644 erpnext/fleet_management/doctype/vehicle_log/test_vehicle_log.py
 create mode 100644 erpnext/fleet_management/doctype/vehicle_log/vehicle_log.js
 create mode 100644 erpnext/fleet_management/doctype/vehicle_log/vehicle_log.json
 create mode 100644 erpnext/fleet_management/doctype/vehicle_log/vehicle_log.py
 create mode 100644 erpnext/fleet_management/doctype/vehicle_service/__init__.py
 create mode 100644 erpnext/fleet_management/doctype/vehicle_service/vehicle_service.json
 create mode 100644 erpnext/fleet_management/doctype/vehicle_service/vehicle_service.py
 create mode 100644 erpnext/fleet_management/report/__init__.py
 create mode 100644 erpnext/fleet_management/report/vehicle_expenses/__init__.py
 create mode 100644 erpnext/fleet_management/report/vehicle_expenses/vehicle_expenses.js
 create mode 100644 erpnext/fleet_management/report/vehicle_expenses/vehicle_expenses.json
 create mode 100644 erpnext/fleet_management/report/vehicle_expenses/vehicle_expenses.py
 create mode 100644 erpnext/hr/doctype/process_payroll/test_process_payroll.py
Requirement already up-to-date: pip in ./env/lib/python2.7/site-packages
Migrating trading.marketsimple.com
Executing execute:frappe.reload_doctype('Employee') in trading.marketsimple.com (c7cd8ec800acdd3d)
Success
Executing execute:frappe.db.sql("update `tabEmployee` set prefered_contact_email = IFNULL(prefered_contact_email,'') ") in trading.marketsimple.com (c7cd8ec800acdd3d)
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, 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 716, in __call__
    return self.main(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1060, 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 1060, 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 889, 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 534, 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 209, in migrate
    migrate(context.verbose, rebuild_website=rebuild_website)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py", line 30, 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 81, in execute_patch
    exec patchmodule.split("execute:")[1] in globals()
  File "<string>", line 1, in <module>
  File "/home/frappe/frappe-bench/apps/frappe/frappe/database.py", line 148, in sql
    self._cursor.execute(query)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 205, in execute
    self.errorhandler(self, exc, value)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
_mysql_exceptions.OperationalError: (1054, "Unknown column 'prefered_contact_email' in 'field list'")
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 9, in <module>
    load_entry_point('bench', 'console_scripts', 'bench')()
  File "/home/frappe/.bench/bench/cli.py", line 40, in cli
    bench_command()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/.bench/bench/commands/update.py", line 60, in update
    _update(pull, patch, build, bench, auto, restart_supervisor, requirements, no_backup, upgrade, force=force)
  File "/home/frappe/.bench/bench/commands/update.py", line 90, in _update
    patch_sites(bench_path=bench_path)
  File "/home/frappe/.bench/bench/utils.py", line 161, in patch_sites
    run_frappe_cmd('--site', 'all', 'migrate', bench_path=bench_path)
  File "/home/frappe/.bench/bench/utils.py", line 501, in run_frappe_cmd
    raise CommandFailedError(args)
bench.utils.CommandFailedError: ('--site', 'all', 'migrate')

Thanks for reporting the issue. It has been fixed via https://github.com/frappe/erpnext/pull/6634. Will be merged soon.

thanks @KanchanChauhan
i hope it could be fixed soon, so that accessing to my site will be restored.

merged

thanks @nabinhait

it works now.