Bench upgrade error: _mysql_exceptions.OperationalError: (1048, "Column 'in_dialog' cannot be null")


Getting below error while upgrading from v 7.2 to 8. Can I get some help to solve it?

Executing frappe.patches.v8_0.update_global_search_table in site1.local (1bd3e0294d)
Executing frappe.patches.v7_2.remove_in_filter in site1.local (1bd3e0294d)
Executing execute:frappe.reload_doc('core', 'doctype', 'doctype', force=True) #2017-03-09 in site1.local (1bd3e0294d)
Executing execute:frappe.reload_doc('core', 'doctype', 'docfield', force=True) #2017-03-03 in site1.local (1bd3e0294d)
Traceback (most recent call last):
  File "/usr/lib/python2.7/", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/", line 72, in _run_code
    exec code in run_globals
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/utils/", line 79, in <module>
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/utils/", line 16, in main
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/", line 696, in main
    rv = self.invoke(ctx)
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/commands/", line 24, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/commands/", line 210, in migrate
    migrate(context.verbose, rebuild_website=rebuild_website)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/", line 31, in migrate
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/", line 29, in run_all
    if not run_single(patchmodule = patch):
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/", line 63, in run_single
    return execute_patch(patchmodule, method, methodargs)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/", line 81, in execute_patch
    exec patchmodule.split("execute:")[1] in globals()
  File "<string>", line 1, in <module>
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/", line 663, in reload_doc
    return frappe.modules.reload_doc(module, dt, dn, force=force, reset_permissions=reset_permissions)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/", line 152, in reload_doc
    return import_files(module, dt, dn, force=force, reset_permissions=reset_permissions)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/", line 19, in import_files
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/", line 24, in import_file
    ret = import_file_by_path(path, force, pre_process=pre_process, reset_permissions=reset_permissions)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/", line 58, in import_file_by_path
    ignore_version=ignore_version, reset_permissions=reset_permissions)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/", line 129, in import_doc
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/", line 205, in insert
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/", line 296, in db_insert
    ), d.values())
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/", line 138, in sql
    self._cursor.execute(query, values)
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/", line 205, in execute
    self.errorhandler(self, exc, value)
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
_mysql_exceptions.OperationalError: (1048, "Column 'in_dialog' cannot be null")

Hi I am also getting the same error. Have you found the solution yet?

No, checked on other instance as well, upgrade is giving error after latest release.

Till last release (Release v8.0.14) I was able to upgrade same instance which failed with Release v8.0.15.

I am getting the same error… Any fixes yet??


You can try this:

cd ~/frappe-bench
bench --site sitename mysql
ALTER TABLE tabDocType MODIFY COLUMN in_dialog int(1) NULL;

Then run bench update.

After that you can change the previous mysql command as before:


1 Like

Thanks @Krishna_Das

Update worked perfectly after modifying column, but after update re-modifying column gave error as below.

ERROR 1054 (42S22): Unknown column ‘in_dialog’ in ‘tabDocType’

Same problem. The ALTER TABLE solution above did not seem to solve the problem. Any advice is greatly appreciated!

I have the same. I added the column in_dialog manually, but this is not resolving the isssue.
I’m migrating (or try) from 8.013 to 9

I’m almost through with a fix for this. Follow the progress here:

I finally was able to migrate to V9.
This is what I did:

Install ERPnext
I installed a complete new instance of erpnext

  1. Download the install script
  2. Run the install script
    sudo python --production --user frappe

Copy content of site1.local (or your site directory) to the corresponding directory in the new created instance of frappe-bench.

Copy your last backup of your database to /frappe/frappe-bench/
Something like 20170421_091326_2a418746_database.sql

Open terminal
Type “sudo su”
Go to the frappe-bench folder
“cd /home/frappe/frappe-bench“
Run the following bench commands (to restore db and run latest)
If needed install extensions:
install base_vat
bench get-app base_vat GitHub - saguas/frappe_base_vat: Repository for frappe base vat application
bench install-app base_vat

install poll
bench get-app poll GitHub - frappe/poll: Online Polling App
bench install-app poll

restore ERPnext database
bench --force restore sqlfile.sql (sqlfile.sql = name of the recent backupfile)

bench mysql
ALTER TABLE tabDocType ADD COLUMN restrict_to_domain VARCHAR(40);
bench --force reload-doc core doctype page

You will need to copy the encryption keys from your old server. (they will be there in bench/sites/sitename/site_config.json)

bench build
bench migrate
bench restart

I did all the steps you mentioned, it worked, but when i login i get a blank page with ERPNext logo in the center, can you help me please?

What version did you upgrade from?