Hi,
As soon as I updated to 10.2.6, I started getting errors. I have been troubleshooting for hours, and it seems like when CSS is injected and aggregated (via core), it causes the following error:
Symfony\Component\HttpKernel\Exception\BadRequestHttpException: The libraries to include are encoded incorrectly. in Drupal\system\Controller\AssetControllerBase->Drupal\system\Controller\{closure}() (line 168 of /var/www/html/web/core/modules/system/src/Controller/AssetControllerBase.php).
The browser console also includes errors like:
Refused to apply style from <URL> because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
Comments
Comment #1
duckydan commentedDrupal Version 10.2.6
Apache 2.4.58
PHP 8.3.6
MariaDB 10.11.7
Memory limit 512M
Comment #2
duckydan commentedComment #3
rajan kumar@2026 commentedComment #4
rajan kumar@2026 commentedComment #5
mably commentedSame problem here :(
Comment #6
mably commentedComment #7
mably commentedLooks like "/" are allowed only once in library names:
And here is what I have this for $library in my case:
asset_injector/css/fix_padding_top_exposition_sliderComment #9
mably commentedMR created.
Chose "." as the replacement separator.
Comment #10
duckydan commentedWorks great.
Thank you!
Comment #11
maxilein commentedPatch solved it for me as well. Thank you!
Comment #12
justcaldwellThat fixed it for us, too. Thanks @mably! 🙏
Comment #13
justcaldwellTweaked the title and summary a bit to add some context.
Comment #14
justcaldwellFor reference, the changes that triggered this issue appear to have occurred in #3416700: Handle invalid compressed ajax_page_state more gracefully
Comment #15
anybodyJust ran into this after updating Drupal to 10.2.6.
I'm going to ping the maintainer as this is indeed critical and hard to find!
Furthermore we should open an issue in core for these things:
if (substr_count($library, '/') !== 1) {Comment #16
anybodyComment #17
anybodyComment #18
geek-merlinReviewing MR...
Comment #19
geek-merlinYes, this makes sense.
Adding attributions.
Comment #21
geek-merlinAnd released, and off:
https://www.drupal.org/project/asset_injector/releases/8.x-2.20
Comment #22
anybodyThank you very very much for your super quick reaction @geek-merlin! 🎉🚀
Comment #23
mably commentedThank you @geek-merlin !
Comment #24
fonant commentedThat was a nice fast fix! Thank you @geek-merlin!
Comment #25
anybodyHere's the follow-up in core: #3445072: Improve "The libraries to include are encoded incorrectly" check and message
Comment #26
avpadernoComment #27
edmoreta commentedI confirmed this fixes the issue for Drupal core 10.2.x (10.2.6), patch applied on asset_injector v2.17.0 (no update for this module, so using patch instead)
Comment #28
duckydan commented@edmoreta I think the most recent release (2.20) has this fix. I may be misunderstanding.
Comment #29
edmoreta commentedI haven't updated the asset_injector version, I need to stick to v2.17.0. I'm using a patch for that reason
Comment #31
trevorbradley commentedNote: This error was so bad on 2.19 (Complete CSS collapse) as we updated to 10.2.6, and the fix with 2.20 so complete, it's my opinion only but I'd strongly recommend flagging 2.19 as no longer supported.
We didn't catch in in our local and our dev environments because JS aggregation was only enabled on prod.