About This HTML Issue
Each image candidate in a srcset attribute needs its own width descriptor, so two candidates cannot share the same w value.
The browser combines the width descriptors with the sizes attribute to pick the file that best fits the layout. When two candidates have the same width, the browser has no way to tell them apart, so it keeps the first one and drops the other. The second file is never downloaded. The HTML standard forbids duplicate width descriptors, and the validator names the two image URLs that share the value. Long srcset values are left out of the message, which is why it can start with Bad value for and an empty value.
A CMS or build script that writes resized copies of an image often causes this. If it takes the descriptors from the original file instead of from each copy, and the original is smaller than the largest size requested, several copies end up labeled with the original's width.
To fix it, make each descriptor match the real pixel width of its file. If two entries point to files of the same width, or a larger file is only an upscaled copy of a smaller one, remove the extra entry. The same rule applies to srcset on <img>.
Invalid example
Both candidates claim a width of 800w, although the second file is 1200 pixels wide:
<picture>
<source srcset="photo-800.webp 800w, photo-1200.webp 800w" sizes="100vw">
<img src="photo-800.jpg" alt="A field at sunset">
</picture>
Valid example
Each descriptor now matches the width of its file:
<picture>
<source srcset="photo-800.webp 800w, photo-1200.webp 1200w" sizes="100vw">
<img src="photo-800.jpg" alt="A field at sunset">
</picture>
Find issues like this automatically
Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.