Error on bench update --patch after switch-to master

Hi Team, All,

Can anyone please assist with the following error? I get this when I do:

bench switch-to-master
bench update --patch

frappe-bench chudeosiegbu$ bench update --patch
Migrating erpnext_dev
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/", line 72, in _run_code
    exec code in run_globals
  File "/Users/chudeosiegbu/frappe-bench/apps/frappe/frappe/utils/", line 79, in <module>
  File "/Users/chudeosiegbu/frappe-bench/apps/frappe/frappe/utils/", line 16, in main
  File "/Users/chudeosiegbu/frappe-bench/env/lib/python2.7/site-packages/click/", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/Users/chudeosiegbu/frappe-bench/env/lib/python2.7/site-packages/click/", line 696, in main
    rv = self.invoke(ctx)
  File "/Users/chudeosiegbu/frappe-bench/env/lib/python2.7/site-packages/click/", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/chudeosiegbu/frappe-bench/env/lib/python2.7/site-packages/click/", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/chudeosiegbu/frappe-bench/env/lib/python2.7/site-packages/click/", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/chudeosiegbu/frappe-bench/env/lib/python2.7/site-packages/click/", line 534, in invoke
    return callback(*args, **kwargs)
  File "/Users/chudeosiegbu/frappe-bench/env/lib/python2.7/site-packages/click/", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Users/chudeosiegbu/frappe-bench/apps/frappe/frappe/commands/", line 24, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/Users/chudeosiegbu/frappe-bench/apps/frappe/frappe/commands/", line 209, in migrate
    migrate(context.verbose, rebuild_website=rebuild_website)
  File "/Users/chudeosiegbu/frappe-bench/apps/frappe/frappe/", line 32, in migrate
  File "/Users/chudeosiegbu/frappe-bench/apps/frappe/frappe/model/", line 19, in sync_all
    sync_for(app, force, verbose=verbose)
  File "/Users/chudeosiegbu/frappe-bench/apps/frappe/frappe/model/", line 44, in sync_for
    import_file_by_path(doc_path, force=force)
  File "/Users/chudeosiegbu/frappe-bench/apps/frappe/frappe/modules/", line 54, in import_file_by_path
    import_doc(doc, force=force, data_import=data_import, pre_process=pre_process)
  File "/Users/chudeosiegbu/frappe-bench/apps/frappe/frappe/modules/", line 122, in import_doc
  File "/Users/chudeosiegbu/frappe-bench/apps/frappe/frappe/model/", line 218, in insert
  File "/Users/chudeosiegbu/frappe-bench/apps/frappe/frappe/model/", line 296, in db_insert
    ), d.values())
  File "/Users/chudeosiegbu/frappe-bench/apps/frappe/frappe/", line 137, in sql
    self._cursor.execute(query, values)
  File "/Users/chudeosiegbu/frappe-bench/env/lib/python2.7/site-packages/MySQLdb/", line 205, in execute
    self.errorhandler(self, exc, value)
  File "/Users/chudeosiegbu/frappe-bench/env/lib/python2.7/site-packages/MySQLdb/", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
_mysql_exceptions.OperationalError: (1048, "Column 'in_standard_filter' cannot be null")


Hi, I don’t know how but it is possible that you should use bench mysql and found in which tables you have column in_standard_filter and then remove them

Hi @SwitsolAG,

I’m trying to avoid tampering with the database directly. Especially if the error isn’t specific to me in which case there should be a general solution.


I think that problem because you used develop which has this column and then decided to use master which doesn’t have data for this column and then you had a problem for empty columns. I correct about branches or didn’t?

You’re right @SwitsolAG I see the issue. in develop branch, docfield.json has had a field in_standard_filter introduced. This field is not present in the master branch.

Also the table schema in develop branch has been modified to include this field as NOT NULL

This means that when one switches back to master branch and tries bench update, docfields cannot be inserted because the table has the in_standard_filter column with the NOT NULL constraint but the docfield.json in master branch doesn’t have this field.

@rmehta i noticed you made this change. How would you suggest we fix? When switching to master and doing bench update —patch should:

  • the column in_standard_filter in the tabDocField table be dropped through a patch or
  • the column in_standard_filter be modified to remove the NOT NULL constraint

Like I replied on chat, use separate sites, benches for master and develop

Thanks Rushabh.