How to diagnose an icon that returns HTML instead of an image
Answer in brief
Inspect the response body and Content-Type as well as the HTTP status. A fallback route can return a successful HTML page for a missing asset path.
Follow the failing request
Open the request for /icons/receipt.png and look at its final URL, response headers and preview. If the response begins with application markup, fix the static file path or route ordering and retest the image request directly.
Check redirections and login responses
A request to a protected image route can follow a redirect and end on an HTML sign-in page. Inspect the redirect chain in the network panel with an expired test session. A public asset may need a different location, while a private thumbnail may need the application to refresh access.
Sources
- [1] Content-Type header - HTTP — MDN Web Docs, accessed November 23, 2026
Frequently asked questions
Does changing Content-Type turn an HTML response into PNG?
The bytes must actually encode a valid image. Correct both the asset lookup and its media type.