I am having trouble with a custom module. When my site is working properly, the /user page loads 4 CSS files. After rebuilding the cache, only three files load. It's not a 404, Drupal doesn't even try to load the last file.

If I disable the module and load the /user page, the CSS loads properly. I can then re-enable the module and the /user page continues to work. Doing a cache rebuild breaks it again. I'm wondering how that CSS file is generated, and how I can make it load properly when my module is enabled.

Oddly, this issue occurs even if I remove all implementation details from the module: the xyz.services.yml file and the src folder. The only remaining files are README.md and the barebones xyz.info.yml file:

name: XYZ Customizations
description: XYZ-specific additions and modifications.
package: Custom
type: module
version: 1.0
core: 8.x

I'm very confused why this might be happening. Any insight would be appreciated. Thanks!

  • I think we'll need a lot more information, and definitely some relevant code. To start, what does your libraries.yml file look like? An dhow about the code that is responsible for injecting the CSS? What steps have you taken to attempt to resolve the issue?
    – Beau
    May 8, 2020 at 18:56
  • 2
    Assuming aggregation is enabled, how that CSS file is generated can be pretty complicated. It might be better to approach it from the other side: what does the code in your middleware do exactly? Which line(s) are causing the problem, or does the presence of the middleware itself, with no implementation, cause it? If you could edit the question and add some details it might be easier to help debug it
    – Clive
    May 8, 2020 at 18:56
  • Question edited, thank you. The problem occurs even with zero implementation in the module. May 12, 2020 at 18:42

1 Answer 1


As it turns out, my custom module folder had the same name as my site's active theme. I believe this was causing the error. Renaming the module appears to have resolved the issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.