Came across this error when we were checking once of our sites. Apparently it was affecting over 200 URLs' in that site and this was affecting that site's rank in the SERPS.
This error affects websites designed using WordPress. One of WordPress features is that it automatically creates an Attachment URL (a blank web page) for every image that is uploaded to the site.
Problem is when Google finds those pages, your ranking takes a dive because of the sudden increase in the number of pages, with no increase in content. This can cause your site to be hit with Google penalties and drop down the ranks.
Yoast Seo, a WordPress SEO plugin has a setting which redirects those pages directly to the images itself. Unfortunatly, there was a bug in one of their updates where that setting was disabled. This caused Google to discover those attachment URLs. Read more about that and how Yoast has addressed the problem.
Yoast has already fixed the bug with an update but the damage has already been done in Google. So first priority is to get Google to remove those URLs from their record. This process usually takes months as Google slowly updates their records. Yoast created another plugin called Search Index Purge to fix this problem fast.
Download and Install the Search Index Purge from Yoast.
Login into Google Search Console and delete any old sitemaps.
More about attachment pages and what they are.
Separate media pages may work for photographers, artists, and graphic designers, as they help to create galleries and sliders. But for standard WordPress users, it makes sense to redirect WordPress attachments pages to the posts or pages that they rightly belong to. As a bonus, your site’s SEO may improve.
Finally, learn how to redirect attachment pages to original post or page.