Error Log: 'job_name': u'frappe.utils.global_search.sync_global_search'

Hello everyone,
After I ran bench update I am encounter with this log in Error Log. Do you have any suggestion on this?

{‘retry’: 0, ‘log’: <function log at 0x7fe6d8ac5e60>, ‘site’: u’site1.local’, ‘event’: u’all’, ‘method_name’: u’frappe.utils.global_search.sync_global_search’, ‘method’: <function sync_global_search at 0x7fe6d96dd6e0>, ‘user’: u’Administrator’, ‘kwargs’: {}, ‘async’: True, ‘job_name’: u’frappe.utils.global_search.sync_global_search’}
Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/background_jobs.py”, line 97, in execute_job
method(**kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/global_search.py”, line 318, in sync_global_search
frappe.db.sql(‘’’
TypeError: ‘NoneType’ object is not iterable

What you might try is to rerun ‘bench update’, ‘bench migrate’ and also try ‘bench rebuild-global-search’

The output as follows

frappe@erp:~/frappe-bench$ bench update
INFO:bench.utils:updating bench
INFO:bench.utils:git pull
Already up to date.
INFO:bench.utils:./env/bin/pip install Pillow
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won’t be maintained after that date. A future version of pip will drop support for Python 2.7.
Requirement already satisfied: Pillow in ./env/lib/python2.7/site-packages (5.3.0)
INFO:bench.app:pulling frappe
INFO:bench.utils:git pull upstream v10.x.x
From GitHub - frappe/frappe: Low code web framework for real world applications, in Python and Javascript

  • branch v10.x.x → FETCH_HEAD
    Already up to date.
    INFO:bench.utils:find . -name “*.pyc” -delete
    INFO:bench.app:pulling erpnext
    INFO:bench.utils:git pull upstream v10.x.x
    From GitHub - frappe/erpnext: Free and Open Source Enterprise Resource Planning (ERP)
  • branch v10.x.x → FETCH_HEAD
    Already up to date.
    INFO:bench.utils:find . -name “*.pyc” -delete
    Updating Python libraries…
    INFO:bench.utils:./env/bin/pip install --upgrade pip
    DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won’t be maintained after that date. A future version of pip will drop support for Python 2.7.
    Requirement already up-to-date: pip in ./env/lib/python2.7/site-packages (19.0.3)
    INFO:bench.utils:./env/bin/pip install -q -r /home/frappe/.bench/requirements.txt
    DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won’t be maintained after that date. A future version of pip will drop support for Python 2.7.
    INFO:bench.app:installing frappe
    INFO:bench.utils:./env/bin/pip install -q -e ./apps/frappe
    DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won’t be maintained after that date. A future version of pip will drop support for Python 2.7.
    INFO:bench.app:installing erpnext
    INFO:bench.utils:./env/bin/pip install -q -e ./apps/erpnext
    DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won’t be maintained after that date. A future version of pip will drop support for Python 2.7.
    Updating node packages…
    INFO:bench.utils:npm install
    npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
    npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.2.7
    npm WARN frappe@ No description
    Backing up sites…
    Patching sites…
    Migrating site1.local
    Updating DocTypes for frappe : [========================================]
    Updating DocTypes for erpnext : [========================================]
    Migrating site2.local
    Updating DocTypes for frappe : [========================================]
    Updating DocTypes for erpnext : [========================================]
    Wrote css/frappe-web.css - 65.11 KB
    Wrote js/frappe-web.min.js - 132.77 KB
    Wrote js/control.min.js - 77.1 KB
    Wrote js/dialog.min.js - 117.07 KB
    Wrote css/desk.min.css - 309.05 KB
    Wrote css/frappe-rtl.css - 32.49 KB
    Wrote js/libs.min.js - 1.13 MB
    Wrote js/desk.min.js - 460.07 KB
    Wrote css/module.min.css - 2.08 KB
    Wrote css/form.min.css - 4.47 KB
    Wrote js/form.min.js - 196.97 KB
    Wrote css/list.min.css - 13.36 KB
    Wrote js/list.min.js - 154.9 KB
    Wrote css/report.min.css - 7.89 KB
    Wrote js/report.min.js - 260.58 KB
    Wrote js/web_form.min.js - 247.55 KB
    Wrote css/web_form.css - 24.42 KB
    Wrote js/print_format_v3.min.js - 23.39 KB
    Wrote css/erpnext.css - 8.1 KB
    Wrote js/erpnext-web.min.js - 3.8 KB
    Wrote js/erpnext.min.js - 162.18 KB
    Wrote js/item-dashboard.min.js - 8.13 KB

Bench: Deployment tool for Frappe and ERPNext (https://erpnext.org).
Open source depends on your contributions, so please contribute bug reports, patches, fixes or cash and be a part of the community
()
frappe@erp:~/frappe-bench$ bench --site site1.local migrate
Migrating site1.local
Updating DocTypes for frappe : [========================================]
Updating DocTypes for erpnext : [========================================]
frappe@erp:~/frappe-bench$ bench --site site2.local migrate
Migrating site2.local
Updating DocTypes for frappe : [========================================]
Updating DocTypes for erpnext : [========================================]
frappe@erp:~/frappe-bench$ bench --site site1.local rebuild-global-search
Rebuilding Global Search : [========================================]
frappe@erp:~/frappe-bench$ bench --site site2.local rebuild-global-search
Rebuilding Global Search : [========================================]
frappe@erp:~/frappe-bench$

All seems fine by the output above, but after a few minutes, the same error appears again.

Installed Apps
ERPNext: v10.1.81 (898977b) (v10.x.x)
Frappe Framework: v10.1.71-8 (92dc1e0) (v10.x.x)

The History shows lots of changes in the last few months frappe/global_search.py at develop · frappe/frappe · GitHub

Whether say fixes there have also been applied to v10 is one question?

Best report this on Issues · frappe/frappe · GitHub

You might load your data into a v11 instance to check for this problem.

Another option is to set a breakpoint to debug what Python code has a null value that causes the sql expresssion to error.