Sudden 404 errors for multiple theme assets (images, scripts) when using the Liquid asset_url filter (e.g., asset_url | script_tag) to load a jQuery file. The generated asset URL resolved, but returned 404 when requested.
Noted behavior: some asset URLs began changing on their own (path segment shifting from t/27 to t/10), restoring access for some files but not others. No code changes were made during this.
Workaround reported:
Export the broken theme as a .zip (no code changes).
Upload the .zip as a new theme and publish it.
Result: asset URLs worked again; 404s disappeared.
Reactions: Other participants objected to marking this as a solution, calling it a reproducible bug and arguing that such steps shouldn’t be required for assets to load.
Key term: asset_url is a Shopify Liquid filter that outputs the URL to a theme asset.
Status: No confirmed root cause or official fix. A workaround exists, but the issue appears unresolved and potentially ongoing. Code snippets are central to understanding the problem.
Without my understanding why, I found myself full of 404s on my site (image, script, etc.)
I tried to find where the problem was coming from and found that the asset_url tag itself didn’t seem to work, at least it didn’t lead to my files. Here is an example :
In theme.liquid, I have this line:
{{ 'jquery.min.js' | asset_url | script_tag }}
When I display my theme, this is what I get:
Except that this leads, you will understand, to a 404.
I admit that I do not understand how this is possible and why all of a sudden it no longer works.
Is there a way to “regenerate” the asset_url, or something like that?
While I was doing my tests, some asset URLs started to change, without me doing anything. t/27 became t/10 and the files were accessible again. But not all. Mind-blowing.
After tearing my hair out for a few hours. I solved the problem in the following way:
I created a .zip file of my theme that no longer worked (the one with problem with asset_url) without changing any line of code
I created a “new” theme from this .zip file. I published it.