Runtime error after clearing cache in Docker terminal (DDEV)

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.

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 :slight_smile:

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.

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

$ 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

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

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

Hi,

Now I’m seeing a Bad Gateway error.

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