ComponentLookupError, IStorage, NamedBlobImage, and black magic

Why would I be getting this error?

ComponentLookupError: (<InterfaceClass plone.namedfile.interfaces.IStorage>, 'plone.namedfile.file.NamedBlobImage')

I don't understand why IStorage wouldn't be registered in this case.

I am running a Plone -> CastleCMS import script, https://github.com/castlecms/castle.cms/blob/master/castle/cms/_scripts/importjson.py which eventually gets down to https://github.com/castlecms/castle.cms/blob/master/castle/cms/_scripts/importtypes.py#L276

The error is occuring at these lines: https://github.com/plone/plone.namedfile/blob/2ef60ab90f5ebe217505e54c04ec487de378a967/plone/namedfile/file.py#L343

The full error trace is

2018-03-28 04:57:53 ERROR castle.cms Error importing object
Traceback (most recent call last):
  File "importjson.py", line 266, in import_pages
    import_object(filepath, count)
  File "importjson.py", line 237, in import_object
    importtype.post_creation(obj)
  File "/home/kim/src/castle.cms/castle/cms/_scripts/importtypes.py", line 284, in post_creation
    filename=to_unicode(filename))
  File "/home/kim/src/castle.cms/eggs/plone.namedfile-3.0.10.dev0-py2.7.egg/plone/namedfile/file.py", line 433, in __init__
    super(NamedBlobImage, self).__init__(data, filename=filename)
  File "/home/kim/src/castle.cms/eggs/plone.namedfile-3.0.10.dev0-py2.7.egg/plone/namedfile/file.py", line 383, in __init__
    self._setData(data)
  File "/home/kim/src/castle.cms/eggs/plone.namedfile-3.0.10.dev0-py2.7.egg/plone/namedfile/file.py", line 440, in _setData
    super(NamedBlobImage, self)._setData(data)
  File "/home/kim/src/castle.cms/eggs/plone.namedfile-3.0.10.dev0-py2.7.egg/plone/namedfile/file.py", line 400, in _setData
    storable = getUtility(IStorage, name=dottedName)
  File "/home/kim/src/castle.cms/eggs/zope.component-3.9.5-py2.7.egg/zope/component/_api.py", line 169, in getUtility
    raise ComponentLookupError(interface, name)
ComponentLookupError: (<InterfaceClass plone.namedfile.interfaces.IStorage>, 'plone.namedfile.file.NamedBlobImage')

The storages.py module in plone.namedfile contains various IStorage utilities which handle storing file data from various sources. They are looked up as named utilities where the name is the dotted class name of the data object that was passed to the NamedBlobImage constructor. Looks like there is no IStorage utility for storing data from another instance of NamedBlobImage. Maybe if your importer has a NamedBlobImage instance to begin with it can just use it rather than trying to create a new one.

Thx @davisagli. Your solution worked, which was to just use the NamedBlobImage instance instead of trying to set another one's data from it.