Recently updated Drupal to 8.7.1 and I am seeing the following error when running database update:

www-data@php.container:/var/www/html/web $ drush updb -y
The following updates are pending:

media_library module :
  8701 -   Create the 'media_library' image style.
  8702 -   Updates the media library view widget display (contextual) filters.

comment module :
  Add comment settings.

media_library module :
  Create and configure Media Library form and view displays for media types.
  Add a table display to the media library view and link gridtable displays.

media module :
  Keep media items viewable at media{id}.

menu_link_content module :
  Update custom menu links to be revisionable.

system module :
  Initialize 'expand_all_items' values to system_menu_block.
  Clear the menu cache.   @see https:www.drupal.orgprojectdrupalissues3044364

taxonomy module :
  Update taxonomy terms to be revisionable.
  Remove the 'hierarchy' property from vocabularies.

views module :
  Update exposed filter blocks label display to be disabled.
  Rebuild cache to allow placeholder texts to be translatable.

Do you wish to run all pending updates? (y/n): y
'image_style' entity with ID 'media_library' already exists.                                          [error]
Performing media_library_update_8701                                                                     [ok]
Failed: 'image_style' entity with ID 'media_library' already exists.                                  [error]
Cache rebuild complete.                                                                                  [ok]
Finished performing updates.                                                                             [ok]

I was able to fix this by doing the following:

Removing the media_libary (I'm using git but if not you can move it somewhere):

rm image.style.media_library.yml
rm views.view.media_library.yml

Run configuration import:

drush cim -y 

Now run database update:

drush updb -y

Now add the removed config items back in:

git checkout ./

Run configuration import again:

drush cim -y

Now you should be all set.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.