I have this website with about 3000 posts and 4000 images in the media library.
For a long time now, some image thumbnails will randomly disappear from the media library:
When I click to open the attachment details, I can see some of its details, like the upload date, size, URL, title, caption, etc.
Clicking the "Regenerate Thumbnails" button produces an error message stating "ERROR: Unable to load the metadata for this attachment".
If I copy the URL and paste it on the address bar, I can see the image.
It is also displayed correctly as the featured image on the post edit metabox.
Examining the database, I noticed these images with broken thumbnails are missing its
_wp_attachment_metadata metadata entries from the
According to the content creators, when the posts are created and the images are uploaded they display fine, and after a period of time they start disappearing randomly. I haven't been able to detect a pattern.
We're running WordPress 5.1 with Apache and PHP 5.6, but these issues happened before on different versions and also back when the site was hosted on a different environment, running nginx with a different PHP version.