«Cannot gather stats» while opening a product in the backend (and my fix)

A similar problem:



My fix

SET @file = '/0/0/00fd10a57da2c072fbf5f037824f6ece35476368_1__2.png';
START TRANSACTION;
DELETE FROM catalog_product_entity_media_gallery WHERE value = @file;
DELETE FROM catalog_product_entity_varchar WHERE value = @file;
COMMIT;

You should specify a path relative to the media/catalog/product folder.
So when yoy see the C:/work/mage2.pro/store/pub/media/catalog/product/m/b/mb01-blue-0.jpg path in the message, you should specify the /m/b/mb01-blue-0.jpg path in the SQL script.

The failure is occured because of a bug in the sample data packages: during an upgrade the sample data packages remove all the non-sample data product images from the pub/media folder.

https://github.com/magento/magento2/issues/4054

https://github.com/magento/magento2/issues/3951

https://github.com/magento/magento2/issues/3964