Cache not able to write because of unknown reason

Hi All,

I have a weird problem in the shop. My shop is gone offline with the error log saying Files in the cache folder cannot create (1 time when I deactivated a plugin, 2 times after the cron jobs completed. So not sure which scheduled task made the issue).
When I have this issue, clearing cache will not work. Only solution to fix this is, re-build and upload the plugin(built by me) which add custom style changes to the shop. Initially there was an error showing from a line in my plugin. I fixed it (error was happening when a snippet loading a number. Added the number directly to the view file and now the error is not showing). But now again the same issue happens. But now the error line is from the 3rd party theme Plugin.

Funny thing is, if I build my custom plugin and upload to shop, the error will be fixed. No need to make any change, fix any error. Build and upload the plugin with a new version is all I need to do.

So as I mentioned, previously error was showing from my custom plugin. Now the issue is showing from 3rd party theme Plugin. The line showing error now is loading a snippet (the content of the snippet is empty in the shop).

My problem here is,

  1. I am not sure what is the reason for the issue here
  2. I’m not sure how to reproduce the error in my machine to fix the issue. How can I reproduce the issue?
  3. Is empty/number in a snippet not allowed? What may be the reason snippet loading line trigger a big issue like this? Or the issue is loading from somewhere else?
  4. I never had this issue in the development period or in the development environment (as far I check), so is it something related to server or production environment?

The error is as follows,

[2025-07-09T01:45:30.704048+00:00] php.ERROR: Warning: include(/var/www/vhosts/domain/var/cache/prod_hffb8b4ff44be3041c902b2186791404a/translations/catalogue.de-DE.aPBPWz+.php): Failed to open stream: No such file or directory {"exception":"[object] (ErrorException(code: 0): Warning: include(/var/www/vhosts/domain/var/cache/prod_hffb8b4ff44be3041c902b2186791404a/translations/catalogue.de-DE.aPBPWz+.php): Failed to open stream: No such file or directory at /var/www/vhosts/domain/vendor/symfony/translation/Translator.php:267)"} []
[2025-07-09T01:45:30.704720+00:00] php.ERROR: Warning: include(): Failed opening '/var/www/vhosts/domain/var/cache/prod_hffb8b4ff44be3041c902b2186791404a/translations/catalogue.de-DE.aPBPWz+.php' for inclusion (include_path='.:/opt/plesk/php/8.2/share/pear') {"exception":"[object] (ErrorException(code: 0): Warning: include(): Failed opening '/var/www/vhosts/domain/var/cache/prod_hffb8b4ff44be3041c902b2186791404a/translations/catalogue.de-DE.aPBPWz+.php' for inclusion (include_path='.:/opt/plesk/php/8.2/share/pear') at /var/www/vhosts/domain/vendor/symfony/translation/Translator.php:267)"} []
[2025-07-09T01:45:30.723991+00:00] request.CRITICAL: Uncaught PHP Exception Shopware\Storefront\Controller\Exception\StorefrontException: "Can not render @TcinnThemeWareElectric/storefront/themeware/twt-base-meta-styles.html.twig view: An exception has been thrown during the rendering of a template ("Symfony\Component\Translation\Translator::getCatalogue(): Return value must be of type Symfony\Component\Translation\MessageCatalogueInterface, bool returned"). with these parameters: {"sendinblueIsPageTrackingEnabled":false,"appShopId":"xxxxxxxxx","themeIconConfig":[],"translateTo":"Deutsch"}" at twt-base-meta-styles.html.twig line 33 {"exception":"[object] (Shopware\\Storefront\\Controller\\Exception\\StorefrontException(code: 0): Can not render @TcinnThemeWareElectric/storefront/themeware/twt-base-meta-styles.html.twig view: An exception has been thrown during the rendering of a template (\"Symfony\\Component\\Translation\\Translator::getCatalogue(): Return value must be of type Symfony\\Component\\Translation\\MessageCatalogueInterface, bool returned\"). with these parameters: {\"sendinblueIsPageTrackingEnabled\":false,\"appShopId\":\"xxxxxxxxx\",\"themeIconConfig\":[],\"translateTo\":\"Deutsch\"} at /var/www/vhosts/domain/custom/plugins/TcinnThemeWareElectric/src/Resources/views/storefront/themeware/twt-base-meta-styles.html.twig:33)\n[previous exception] [object] (Twig\\Error\\RuntimeError(code: 0): An exception has been thrown during the rendering of a template (\"Symfony\\Component\\Translation\\Translator::getCatalogue(): Return value must be of type Symfony\\Component\\Translation\\MessageCatalogueInterface, bool returned\"). at /var/www/vhosts/domain/custom/plugins/TcinnThemeWareElectric/src/Resources/views/storefront/themeware/twt-base-meta-styles.html.twig:33)\n[previous exception] [object] (TypeError(code: 0): Symfony\\Component\\Translation\\Translator::getCatalogue(): Return value must be of type Symfony\\Component\\Translation\\MessageCatalogueInterface, bool returned at /var/www/vhosts/domain/vendor/symfony/translation/Translator.php:206)"} []
[2025-07-09T01:45:30.733184+00:00] request.CRITICAL: Uncaught PHP Exception TypeError: "Symfony\Component\Translation\Translator::getCatalogue(): Return value must be of type Symfony\Component\Translation\MessageCatalogueInterface, bool returned" at Translator.php line 206 {"exception":"[object] (TypeError(code: 0): Symfony\\Component\\Translation\\Translator::getCatalogue(): Return value must be of type Symfony\\Component\\Translation\\MessageCatalogueInterface, bool returned at /var/www/vhosts/domain/vendor/symfony/translation/Translator.php:206)"} []
[2025-07-09T01:45:31.021178+00:00] php.ERROR: Warning: include(/var/www/vhosts/domain/var/cache/prod_hffb8b4ff44be3041c902b2186791404a/translations/catalogue.de-DE.aPBPWz+.php): Failed to open stream: No such file or directory {"exception":"[object] (ErrorException(code: 0): Warning: include(/var/www/vhosts/domain/var/cache/prod_hffb8b4ff44be3041c902b2186791404a/translations/catalogue.de-DE.aPBPWz+.php): Failed to open stream: No such file or directory at /var/www/vhosts/domain/vendor/symfony/translation/Translator.php:267)"} []

The line showing the error in the theme plugin is as follows (I don't find any issue in the code)

{# ThemeWare: Add CSS code via snippets (v1) @deprecated #}
{% set twtSnippetCssCode = ‚twt.custom.css‘|trans|raw %}

{% if twtCustomCss == 2 and twtSnippetCssCode is not empty and twtExpertMode == 2 %}
<!-- Custom css code (old) -->
<style>{% apply spaceless %}
    {{ twtSnippetCssCode }}
{% endapply %}</style>
{% endif %}
The snippet "twt.custom.css" is empty in our shop.

Any help is appreciated.

Thank you

There are a lot of things …

  • your error tells you that the files cannot be found; not that they cannot be written to the cache.
  • I guess you use 'twt.custom.css' and ‚twt.custom.css‘ is just an editor issue: {% set twtSnippetCssCode = ‚twt.custom.css‘|trans|raw %}

@Max_Shop

Thank you for the reply.
Sorry for the wrong explanation.

The shopware write the cache files. So I guessed somehow, shopware failed to write the files to the location because of some error happened from the plugin. But I would like to know how I can reproduce the issue. Running cache clear or build-storefront usually return error message if anything is wrong in our plugin. But I am not getting any. Or there is no error when we run the shop. So I am confused how I can reproduce the issue in local machine. This is where I would like to get your knowledge.

Regarding the snippet usage, the theme plugin use the code correctly as follows.

{# ThemeWare: Add CSS code via snippets (v1) @deprecated #}
    {% set twtSnippetCssCode = 'twt.custom.css'|trans|raw %}

Thank you

Since you got the warning in the error log, that a file does not exist, you also would get an error if Symfony/Shopware could not write to the cache. If something with the cache would not work, I guess the complete store would not run at all.

Did you look the snippet up in the Administration. Does it have a value in the selected language?

Hi @Max_Shop

The snippet do not have any value in the administration. As I mentioned, the snippet comes from the 3rd party theme plugin. So I have nothing to add there. So I kept the default value (which is empty). Do you think this can be a problem?

Thank you

Every snippet is visible in the Administration visible. If not, something is wrong. Uninstall the plugin and install it again.

It must be in the Administration, to give you the opportunity to override the content.

Hi @Max_Shop

The snippet is visible, but there is no value for the German or English. Sorry for the confusion. Can this be a problem?

Yes, of course. The content is empty, thus you get no value. Enter some value and it should work.

Hi @Max_Shop

I did the change you suggested. I will monitor the shop…

Thank you