# Runtime error after clearing cache in Docker terminal (DDEV)

**URL:** <https://forum.mautic.org/t/runtime-error-after-clearing-cache-in-docker-terminal-ddev/31468>\
**Category:** Development\
**Created:** [March 27, 2024, 7:49pm UTC](https://forum.mautic.org/t/runtime-error-after-clearing-cache-in-docker-terminal-ddev/31468 "2024-03-27T19:49:39Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jakobpersson](https://avatars.discourse-cdn.com/v4/letter/j/5e9695/32.png) [@jakobpersson](https://forum.mautic.org/u/jakobpersson)\
**Post date:** [March 27, 2024, 7:49pm UTC](https://forum.mautic.org/t/runtime-error-after-clearing-cache-in-docker-terminal-ddev/31468/1 "2024-03-27T19:49:39Z")

</div>

I tried clearing the cache from within Docker and its terminal and now I keep getting this fatal error:

“ **Twig\Error\RuntimeError:** An exception has been thrown during the rendering of a template (“PHP Warning - filemtime(): stat failed for /var/www/html/var/cache/de\_/AppKernelDevDebugContainer.php”). - in file /app/bundles/CoreBundle/Resources/views/Default/script.html.twig - at line 7"

I ran this command in the Docker terminal: php console cache:clear

A theme I was working on did not appear when I created a new email, so I attempted to clear the cache.

---

<div class="post-metadata">

**Author:** ![jakobpersson](https://avatars.discourse-cdn.com/v4/letter/j/5e9695/32.png) [@jakobpersson](https://forum.mautic.org/u/jakobpersson)\
**Post date:** [March 27, 2024, 8:26pm UTC](https://forum.mautic.org/t/runtime-error-after-clearing-cache-in-docker-terminal-ddev/31468/2 "2024-03-27T20:26:27Z")

</div>

A bit more of the error:

- **/app/bundles/CoreBundle/Resources/views/Default/script.html.twig:7** at
- **/vendor/twig/twig/src/Template.php:367** at Twig\Template → displayWithErrorHandling ( _array_( ‘baseTemplate’ =\> ‘@MauticCore/Default/slim.html.twig’, ‘status\_code’ =\> 500, ‘status\_text’ =\> ‘Internal Server Error’, ‘exception’ =\> _object_(FlattenException), ‘logger’ =\> _object_(Logger), ‘currentContent’ =\> ‘’, ‘isPublicPage’ =\> _true_, ‘currentRoute’ =\> ‘/’, ‘mauticContent’ =\> ‘’, ‘mauticTemplate’ =\> ‘@MauticCore/Exception/500.html.twig’, ‘mauticTemplateVars’ =\> _array_( ‘baseTemplate’ =\> ‘@MauticCore/Default/slim.html.twig’, ‘status\_code’ =\> 500, ‘status\_text’ =\> ‘Internal Server Error’, ‘exception’ =\> _object_(FlattenException), ‘logger’ =\> _object_(Logger), ‘currentContent’ =\> ‘’, ‘isPublicPage’ =\> _true_, ‘currentRoute’ =\> ‘/’, ‘mauticContent’ =\> ‘’, ‘mauticTemplate’ =\> ‘@MauticCore/Exception/500.html.twig’ ), ‘app’ =\> _object_(AppVariable), ‘src’ =\> 'data:image/png;base64,iVBOR…

I noticed that Mautic didn’t recreate the cache directory. I thought it was due the file permissions so I changed file owner from me to www-data:www-data and 775. That only made things worse 🙂

I’ve never used DDEV before. Can I restore the files from the container image?

I’m also curious regarding how to disable caching while creating themes so I don’t need to manually clear the cache on every change.

Thank you.

---

<div class="post-metadata">

**Author:** ![escopecz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/escopecz/32/370_2.png) [@escopecz](https://forum.mautic.org/u/escopecz)\
**Post date:** [March 28, 2024, 9:07am UTC](https://forum.mautic.org/t/runtime-error-after-clearing-cache-in-docker-terminal-ddev/31468/3 "2024-03-28T09:07:26Z")

</div>

What’s the output of `ls -al var/` ?

---

<div class="post-metadata">

**Author:** ![jakobpersson](https://avatars.discourse-cdn.com/v4/letter/j/5e9695/32.png) [@jakobpersson](https://forum.mautic.org/u/jakobpersson)\
**Post date:** [March 28, 2024, 9:38am UTC](https://forum.mautic.org/t/runtime-error-after-clearing-cache-in-docker-terminal-ddev/31468/4 "2024-03-28T09:38:51Z")

</div>

```auto
$ ls -al var/
total 28
drwxrwxr-x 6 www-data www-data 4096 Mar 26 11:50 .
drwxrwxr-x 19 www-data www-data 4096 Mar 26 11:51 ..
-rwxrwxr-x 1 www-data www-data 14 Mar 26 11:36 .htaccess
drwxrwxr-x 6 www-data www-data 4096 Mar 27 17:15 cache
drwxrwxr-x 2 www-data www-data 4096 Mar 27 17:12 logs
drwxrwxr-x 2 www-data www-data 4096 Mar 26 11:36 spool
drwxrwxr-x 3 www-data www-data 4096 Mar 26 11:53 tmp

```

---

<div class="post-metadata">

**Author:** ![escopecz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/escopecz/32/370_2.png) [@escopecz](https://forum.mautic.org/u/escopecz)\
**Post date:** [March 28, 2024, 3:01pm UTC](https://forum.mautic.org/t/runtime-error-after-clearing-cache-in-docker-terminal-ddev/31468/5 "2024-03-28T15:01:47Z")

</div>

I see no issue here and `ls -al var/cache` ?

What is the output of `bin/console cache:warmup` ?

---

<div class="post-metadata">

**Author:** ![jakobpersson](https://avatars.discourse-cdn.com/v4/letter/j/5e9695/32.png) [@jakobpersson](https://forum.mautic.org/u/jakobpersson)\
**Post date:** [April 4, 2024, 7:53am UTC](https://forum.mautic.org/t/runtime-error-after-clearing-cache-in-docker-terminal-ddev/31468/6 "2024-04-04T07:53:26Z")

</div>

Hi,

Now I’m seeing a Bad Gateway error.

---

<div class="post-metadata">

**Author:** ![jakobpersson](https://avatars.discourse-cdn.com/v4/letter/j/5e9695/32.png) [@jakobpersson](https://forum.mautic.org/u/jakobpersson)\
**Post date:** [April 4, 2024, 8:05am UTC](https://forum.mautic.org/t/runtime-error-after-clearing-cache-in-docker-terminal-ddev/31468/7 "2024-04-04T08:05:37Z")

</div>

Did ddev restart and now it’s working. (fingers crossed!)
