Getting error when running discovery update_index

As described in the docs I should run

tutor local run discovery ./manage.py refresh_course_metadata --partner_code=dev
tutor local run discovery ./manage.py update_index --disable-change-limit

but after I run the second command it fails with the following trace:

[ERROR/MainProcess] Failed indexing 1 - 9 (retry 5/5): The model 'None' combined with model_attr 'title' returned None, but doesn't allow a default or null value. (pid 1): The model 'None' combined with model_attr 'title' returned None, but doesn't allow a default or null value.
Traceback (most recent call last):
  File "/openedx/venv/lib/python3.5/site-packages/haystack/management/commands/update_index.py", line 84, in do_update
    backend.update(index, current_qs, commit=commit)
  File "/openedx/venv/lib/python3.5/site-packages/haystack/backends/elasticsearch_backend.py", line 168, in update
    prepped_data = index.full_prepare(obj)
  File "/openedx/venv/lib/python3.5/site-packages/haystack/indexes.py", line 208, in full_prepare
    self.prepared_data = self.prepare(obj)
  File "/openedx/venv/lib/python3.5/site-packages/haystack/indexes.py", line 199, in prepare
    self.prepared_data[field.index_fieldname] = field.prepare(obj)
  File "/openedx/venv/lib/python3.5/site-packages/haystack/fields.py", line 205, in prepare
    return self.convert(super(CharField, self).prepare(obj))
  File "/openedx/venv/lib/python3.5/site-packages/haystack/fields.py", line 88, in prepare
    values = self.resolve_attributes_lookup(current_objects, attrs)
  File "/openedx/venv/lib/python3.5/site-packages/haystack/fields.py", line 127, in resolve_attributes_lookup
    "a default or null value." % (repr(current_object), self.model_attr)
haystack.exceptions.SearchFieldError: The model 'None' combined with model_attr 'title' returned None, but doesn't allow a default or null value.
[ERROR/MainProcess] Error updating course_metadata using default 
Traceback (most recent call last):
  File "/openedx/venv/lib/python3.5/site-packages/haystack/management/commands/update_index.py", line 214, in handle
    self.update_backend(label, using)
  File "/openedx/venv/lib/python3.5/site-packages/haystack/management/commands/update_index.py", line 257, in update_backend
    commit=self.commit, max_retries=self.max_retries)
  File "/openedx/venv/lib/python3.5/site-packages/haystack/management/commands/update_index.py", line 84, in do_update
    backend.update(index, current_qs, commit=commit)
  File "/openedx/venv/lib/python3.5/site-packages/haystack/backends/elasticsearch_backend.py", line 168, in update
    prepped_data = index.full_prepare(obj)
  File "/openedx/venv/lib/python3.5/site-packages/haystack/indexes.py", line 208, in full_prepare
    self.prepared_data = self.prepare(obj)
  File "/openedx/venv/lib/python3.5/site-packages/haystack/indexes.py", line 199, in prepare
    self.prepared_data[field.index_fieldname] = field.prepare(obj)
  File "/openedx/venv/lib/python3.5/site-packages/haystack/fields.py", line 205, in prepare
    return self.convert(super(CharField, self).prepare(obj))
  File "/openedx/venv/lib/python3.5/site-packages/haystack/fields.py", line 88, in prepare
    values = self.resolve_attributes_lookup(current_objects, attrs)
  File "/openedx/venv/lib/python3.5/site-packages/haystack/fields.py", line 127, in resolve_attributes_lookup
    "a default or null value." % (repr(current_object), self.model_attr)
haystack.exceptions.SearchFieldError: The model 'None' combined with model_attr 'title' returned None, but doesn't allow a default or null value.
Traceback (most recent call last):
  File "./manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File "/openedx/venv/lib/python3.5/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File "/openedx/venv/lib/python3.5/site-packages/django/core/management/__init__.py", line 356, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/openedx/venv/lib/python3.5/site-packages/django/core/management/base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/openedx/venv/lib/python3.5/site-packages/django/core/management/base.py", line 330, in execute
    output = self.handle(*args, **options)
  File "/openedx/discovery/course_discovery/apps/edx_haystack_extensions/management/commands/update_index.py", line 44, in handle
    super(Command, self).handle(*items, **options)
  File "/openedx/venv/lib/python3.5/site-packages/haystack/management/commands/update_index.py", line 214, in handle
    self.update_backend(label, using)
  File "/openedx/venv/lib/python3.5/site-packages/haystack/management/commands/update_index.py", line 257, in update_backend
    commit=self.commit, max_retries=self.max_retries)
  File "/openedx/venv/lib/python3.5/site-packages/haystack/management/commands/update_index.py", line 84, in do_update
    backend.update(index, current_qs, commit=commit)
  File "/openedx/venv/lib/python3.5/site-packages/haystack/backends/elasticsearch_backend.py", line 168, in update
    prepped_data = index.full_prepare(obj)
  File "/openedx/venv/lib/python3.5/site-packages/haystack/indexes.py", line 208, in full_prepare
    self.prepared_data = self.prepare(obj)
  File "/openedx/venv/lib/python3.5/site-packages/haystack/indexes.py", line 199, in prepare
    self.prepared_data[field.index_fieldname] = field.prepare(obj)
  File "/openedx/venv/lib/python3.5/site-packages/haystack/fields.py", line 205, in prepare
    return self.convert(super(CharField, self).prepare(obj))
  File "/openedx/venv/lib/python3.5/site-packages/haystack/fields.py", line 88, in prepare
    values = self.resolve_attributes_lookup(current_objects, attrs)
  File "/openedx/venv/lib/python3.5/site-packages/haystack/fields.py", line 127, in resolve_attributes_lookup
    "a default or null value." % (repr(current_object), self.model_attr)
haystack.exceptions.SearchFieldError: The model 'None' combined with model_attr 'title' returned None, but doesn't allow a default or null value.
Error: Command failed with status 1: docker-compose -f /home/ubuntu/.local/share/tutor/env/local/docker-compose.yml --project-name tutor_local run --rm discovery ./manage.py update_index

Do you have any idea why is that is happening?

We are getting the same error, how did you solve your issue?

@tasawernawaz @baha
use this command
tutor local run discovery ./manage.py refresh_course_metadata --partner_code=openedx