You have requested a non-existent service “media_entity.cli”

We upgraded a Drupal site to 8.7 that had used media_entity previously and we needed to get it converted over to core’s media module. We followed all of the directions but we kept running into the error:

You have requested a non-existent service "media_entity.cli"

After a bunch of trial and error we decided to just hack the module by adding a test for the existence of the service before consuming it.

In the file media_entity/media_entity.drush.inc before the line the contains \Drupal::service('media_entity.cli') we added:

if(!\Drupal::hasService('media_entity.cli')){
     return TRUE;
}

2 thoughts on “You have requested a non-existent service “media_entity.cli”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.