PulpDebClient::ApiError - HTTP 500 when running katello:delete_orphaned_content

Traceback:

Sep 30 00:00:23 foreman-01.lab.local pulpcore-api[17769]: pulp: django.request:ERROR: Internal Server Error: /pulp/api/v3/repositories/deb/apt/b577a080-96b8-457c-a5d7-077aab88aba1/versions/
Sep 30 00:00:23 foreman-01.lab.local pulpcore-api[17769]: Traceback (most recent call last):
Sep 30 00:00:23 foreman-01.lab.local pulpcore-api[17769]: File "/usr/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
Sep 30 00:00:23 foreman-01.lab.local pulpcore-api[17769]: response = get_response(request)
Sep 30 00:00:23 foreman-01.lab.local pulpcore-api[17769]: File "/usr/lib/python3.6/site-packages/django/core/handlers/base.py", line 115, in _get_response
Sep 30 00:00:23 foreman-01.lab.local pulpcore-api[17769]: response = self.process_exception_by_middleware(e, request)
Sep 30 00:00:23 foreman-01.lab.local pulpcore-api[17769]: File "/usr/lib/python3.6/site-packages/django/core/handlers/base.py", line 113, in _get_response
Sep 30 00:00:23 foreman-01.lab.local pulpcore-api[17769]: response = wrapped_callback(request, *callback_args, **callback_kwargs)
Sep 30 00:00:23 foreman-01.lab.local pulpcore-api[17769]: File "/usr/lib/python3.6/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
Sep 30 00:00:23 foreman-01.lab.local pulpcore-api[17769]: return view_func(*args, **kwargs)
Sep 30 00:00:23 foreman-01.lab.local pulpcore-api[17769]: File "/usr/lib/python3.6/site-packages/rest_framework/viewsets.py", line 114, in view
Sep 30 00:00:23 foreman-01.lab.local pulpcore-api[17769]: return self.dispatch(request, *args, **kwargs)
Sep 30 00:00:23 foreman-01.lab.local pulpcore-api[17769]: File "/usr/lib/python3.6/site-packages/rest_framework/views.py", line 505, in dispatch
Sep 30 00:00:23 foreman-01.lab.local pulpcore-api[17769]: response = self.handle_exception(exc)
Sep 30 00:00:23 foreman-01.lab.local pulpcore-api[17769]: File "/usr/lib/python3.6/site-packages/rest_framework/views.py", line 465, in handle_exception
Sep 30 00:00:23 foreman-01.lab.local pulpcore-api[17769]: self.raise_uncaught_exception(exc)
Sep 30 00:00:23 foreman-01.lab.local pulpcore-api[17769]: File "/usr/lib/python3.6/site-packages/rest_framework/views.py", line 476, in raise_uncaught_exception
Sep 30 00:00:23 foreman-01.lab.local pulpcore-api[17769]: raise exc
Sep 30 00:00:23 foreman-01.lab.local pulpcore-api[17769]: File "/usr/lib/python3.6/site-packages/rest_framework/views.py", line 502, in dispatch
Sep 30 00:00:23 foreman-01.lab.local pulpcore-api[17769]: response = handler(request, *args, **kwargs)
Sep 30 00:00:23 foreman-01.lab.local pulpcore-api[17769]: File "/usr/lib/python3.6/site-packages/rest_framework/mixins.py", line 43, in list
Sep 30 00:00:23 foreman-01.lab.local pulpcore-api[17769]: return self.get_paginated_response(serializer.data)
Sep 30 00:00:23 foreman-01.lab.local pulpcore-api[17769]: File "/usr/lib/python3.6/site-packages/rest_framework/serializers.py", line 760, in data
Sep 30 00:00:23 foreman-01.lab.local pulpcore-api[17769]: ret = super().data
Sep 30 00:00:23 foreman-01.lab.local pulpcore-api[17769]: File "/usr/lib/python3.6/site-packages/rest_framework/serializers.py", line 260, in data
Sep 30 00:00:23 foreman-01.lab.local pulpcore-api[17769]: self._data = self.to_representation(self.instance)
Sep 30 00:00:23 foreman-01.lab.local pulpcore-api[17769]: File "/usr/lib/python3.6/site-packages/rest_framework/serializers.py", line 678, in to_representation
Sep 30 00:00:23 foreman-01.lab.local pulpcore-api[17769]: self.child.to_representation(item) for item in iterable
Sep 30 00:00:23 foreman-01.lab.local pulpcore-api[17769]: File "/usr/lib/python3.6/site-packages/rest_framework/serializers.py", line 678, in <listcomp>
Sep 30 00:00:23 foreman-01.lab.local pulpcore-api[17769]: self.child.to_representation(item) for item in iterable
Sep 30 00:00:23 foreman-01.lab.local pulpcore-api[17769]: File "/usr/lib/python3.6/site-packages/rest_framework/serializers.py", line 529, in to_representation
Sep 30 00:00:23 foreman-01.lab.local pulpcore-api[17769]: ret[field.field_name] = field.to_representation(attribute)
Sep 30 00:00:23 foreman-01.lab.local pulpcore-api[17769]: File "/usr/lib/python3.6/site-packages/pulpcore/app/serializers/repository.py", line 217, in to_representation
Sep 30 00:00:23 foreman-01.lab.local pulpcore-api[17769]: item_dict = {"count": count_detail.count, "href": count_detail.content_href}
Sep 30 00:00:23 foreman-01.lab.local pulpcore-api[17769]: File "/usr/lib/python3.6/site-packages/pulpcore/app/models/repository.py", line 857, in content_href
Sep 30 00:00:23 foreman-01.lab.local pulpcore-api[17769]: ctype_model = Content.objects.filter(pulp_type=self.content_type).first().cast().__class__
Sep 30 00:00:23 foreman-01.lab.local pulpcore-api[17769]: AttributeError: 'NoneType' object has no attribute 'cast'