Plone.restapi search - AttributeError: portal_url when looking for content type icon

While attempting to search my Plone 5.0.10 site using plone.restapi I found that CMFCore.DynamicType stumbles when attempting to get all metadata as documented here.

http://localhost:8585/Plone/de/@search?SearchableText=Plone&metadata_fields=_all

Traceback (innermost last):
  Module ZPublisher.Publish, line 138, in publish
  Module ZPublisher.mapply, line 77, in mapply
  Module ZPublisher.Publish, line 48, in call_object
  Module plone.rest.service, line 23, in __call__
  Module plone.restapi.services, line 21, in render
  Module plone.restapi.services.search.get, line 11, in reply
  Module plone.restapi.search.handler, line 86, in search
  Module plone.restapi.serializer.catalog, line 41, in __call__
  Module plone.restapi.serializer.summary, line 64, in __call__
  Module plone.restapi.serializer.converters, line 71, in json_compatible
  Module zope.component.hooks, line 104, in adapter_hook
  Module plone.restapi.serializer.relationfield, line 23, in relationvalue_converter
  Module plone.restapi.serializer.summary, line 64, in __call__
  Module plone.restapi.serializer.converters, line 71, in json_compatible
  Module zope.component.hooks, line 104, in adapter_hook
  Module plone.restapi.serializer.relationfield, line 23, in relationvalue_converter
  Module plone.restapi.serializer.summary, line 63, in __call__
  Module Products.CMFCore.DynamicType, line 109, in icon
  Module Products.CMFCore.utils, line 13, in check_getToolByName
  Module Products.CMFCore.utils, line 120, in getToolByName
AttributeError: portal_url

Ignoring the exception returns the results I'm looking for.

However, I'm not sure whether the error is actually in CMFCore. In my attempts to play with plone.restapi earlier today, I came across another error where the relationvalue converter was involved (sorry, no traceback). In that case, it was fixed in plone.app.contentlisting. Maybe these two errors are somehow related?

What to do?

And where in the world is this hidden?

Module Products.CMFCore.utils, line 13, in check_getToolByName

Plone Foundation Code of Conduct