# Diagnose the wrong image selected from srcset

Canonical: https://githtml.com/guides/srcset-selects-wrong-report-image
Published: 2026-11-23
Publisher: WaveTech LLC / gitHtml

When the displayed image differs from src, inspect srcset, sizes, picture sources, and the selected currentSrc in browser tools. The browser may legitimately choose another candidate for the viewport and pixel density. Ensure every candidate represents the intended content, and do not assume changing src alone updates a responsive image.

## Identify the specific failure

A stale high-resolution candidate can survive while the default image has been updated. On one screen the report looks current; on another it shows an old chart. This is a content consistency failure, not necessarily a browser cache failure.

## Make a narrow correction

Compare every candidate's revision and dimensions. Use sizes to describe the rendered slot accurately when using width descriptors. If the portable copy needs only one adequate image, simplify the candidate set deliberately rather than preserving unused alternatives.

1. Inspect currentSrc to identify the resource the browser actually selected.
2. Compare content revisions across all srcset and picture candidates.
3. Simplify or correct the candidate set, then test more than one viewport and density.

````html
<img src="chart-current.png" alt="Current latency distribution" width="900" height="600">
````

## Compare selected bytes, not only the default src attribute

An illustrative chart has a default image updated for November and a high-resolution srcset candidate still showing October. A phone with one display density appears correct while another device shows outdated values. Inspect currentSrc on the rendered image to identify the selected candidate, then open that exact asset and compare its labels. Changing src alone leaves the alternate candidate untouched. A content inventory should associate every candidate with the same approved observation period unless the picture element intentionally supplies a different crop.

When width descriptors are used, sizes describes the intended image slot rather than setting the element's CSS width. An inaccurate slot description can lead the browser to choose an unnecessarily large or insufficiently detailed candidate. Compare the declared slot with the actual rendered width, while keeping resolution selection separate from content correctness. An image can be sharp and still be the wrong revision. Do not force a smaller resource merely to make one screenshot match if that makes labels unreadable on a denser display.

During testing, record viewport size, display density, selected URL, and the content revision visible in the image. Resize or use separate controlled test contexts, remembering that resource selection and reuse are browser decisions rather than a promise to switch at every tiny width change. If all candidates now contain identical correct information, minor selection differences are not themselves a defect. If the reading copy needs no art direction or resolution choices, a single adequately detailed image can reduce maintenance complexity, provided its file size and smallest labels remain appropriate for the intended reading task.

## Verify the repaired artifact

Check both a narrow and wide viewport and inspect the actual selected URL. Visual similarity can hide a materially different annotation.

## Sources and further reading

- [MDN: Responsive_images](https://developer.mozilla.org/en-US/docs/Web/HTML/Guides/Responsive_images)

## Related guides

- [Fix sticky headings that cover the next paragraph](https://githtml.com/guides/sticky-heading-covers-report-text)
- [Diagnose a stylesheet request that returns HTML](https://githtml.com/guides/stylesheet-mime-type-html-response)
- [Why text inside a template element does not appear](https://githtml.com/guides/template-content-not-visible-html)
- [Keep a document readable when a CSS feature is unsupported](https://githtml.com/guides/unsupported-css-feature-fallback)

Editorial approach: https://githtml.com/guides/about
