# CRITICAL: Uncaught PHP Exception Twig error

**URL:** <https://forum.mautic.org/t/critical-uncaught-php-exception-twig-error/31562>\
**Category:** Mautic 5 Install/Upgrade Support\
**Created:** [April 4, 2024, 8:57pm UTC](https://forum.mautic.org/t/critical-uncaught-php-exception-twig-error/31562 "2024-04-04T20:57:48Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![crozilla](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/crozilla/32/2054_2.png) [@crozilla](https://forum.mautic.org/u/crozilla)\
**Post date:** [April 4, 2024, 8:57pm UTC](https://forum.mautic.org/t/critical-uncaught-php-exception-twig-error/31562/1 "2024-04-04T20:57:48Z")

</div>

**Your software**  
My Mautic version is: 5.0.3  
My PHP version is: 8.1  
My Database type and version is: Recent

**Your problem**  
My problem is:  
Recently upgraded from v4 to v5.0.3. Now having a problem creating a Focus item, (also viewing some Reports). Halfway through building one, Mautic craps out and I get the error monster. The rest of Mautic is still functional, mostly.

These errors are showing in the log:  
[2024-04-04T13:52:22.574719+00:00] mautic.CRITICAL: Uncaught PHP Exception Twig\Error\RuntimeError: “Variable “fieldSettings” does not exist.” at /home/username/domain.com/mautic/app/bundles/FormBundle/Resources/views/Builder/form.html.twig line 50 {“exception”:“[object] (Twig\Error\RuntimeError(code: 0): Variable "fieldSettings" does not exist. at /home/username/domain.com/mautic/app/bundles/FormBundle/Resources/views/Builder/form.html.twig:50)”} {“hostname”:“iad1-shared-e1-06”,“pid”:413170}

[2024-04-04T14:28:23.150217+00:00] mautic.CRITICAL: Uncaught PHP Exception Twig\Error\RuntimeError: “An exception has been thrown during the rendering of a template (“Mautic\CoreBundle\Twig\Extension\AssetExtension::makeLinks(): Argument #1 ($text) must be of type string, null given, called in /home/username/domain.com/mautic/var/tmp/twig/ef/ef6787421501ecc99158046e98ee62ae.php on line 124”).” at /home/username/domain.com/mautic/app/bundles/ReportBundle/Resources/views/Graph/Table.html.twig line 37 {“exception”:“[object] (Twig\Error\RuntimeError(code: 0): An exception has been thrown during the rendering of a template ("Mautic\CoreBundle\Twig\Extension\AssetExtension::makeLinks(): Argument #1 ($text) must be of type string, null given, called in /home/username/domain.com/mautic/var/tmp/twig/ef/ef6787421501ecc99158046e98ee62ae.php on line 124"). at /home/username/domain.com/mautic/app/bundles/ReportBundle/Resources/views/Graph/Table.html.twig:37)\n[previous exception] [object] (TypeError(code: 0): Mautic\CoreBundle\Twig\Extension\AssetExtension::makeLinks(): Argument #1 ($text) must be of type string, null given, called in /home/username/domain.com/mautic/var/tmp/twig/ef/ef6787421501ecc99158046e98ee62ae.php on line 124 at /home/username/domain.com/mautic/app/bundles/CoreBundle/Twig/Extension/AssetExtension.php:166)”} {“hostname”:“iad1-shared-e1-06”,“pid”:447319}

Steps I have tried to fix the problem:  
Researched Twig, tried changing themes, but got the same error.

---

<div class="post-metadata">

**Author:** ![crozilla](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/crozilla/32/2054_2.png) [@crozilla](https://forum.mautic.org/u/crozilla)\
**Post date:** [April 5, 2024, 3:24am UTC](https://forum.mautic.org/t/critical-uncaught-php-exception-twig-error/31562/2 "2024-04-05T03:24:49Z")

</div>

Here’s the Report error log (choosing Leads and Points):

[2024-04-04T14:28:23.150217+00:00] mautic.CRITICAL: Uncaught PHP Exception Twig\Error\RuntimeError: “An exception has been thrown during the rendering of a template (“Mautic\CoreBundle\Twig\Extension\AssetExtension::makeLinks(): Argument #1 ($text) must be of type string, null given, called in /home/username/domain.com/mautic/var/tmp/twig/ef/ef6787421501ecc99158046e98ee62ae.php on line 124”).” at /home/username/domain.com/mautic/app/bundles/ReportBundle/Resources/views/Graph/Table.html.twig line 37 {“exception”:“[object] (Twig\Error\RuntimeError(code: 0): An exception has been thrown during the rendering of a template ("Mautic\CoreBundle\Twig\Extension\AssetExtension::makeLinks(): Argument #1 ($text) must be of type string, null given, called in /home/username/domain.com/mautic/var/tmp/twig/ef/ef6787421501ecc99158046e98ee62ae.php on line 124"). at /home/username/domain.com/mautic/app/bundles/ReportBundle/Resources/views/Graph/Table.html.twig:37)\n[previous exception] [object] (TypeError(code: 0): Mautic\CoreBundle\Twig\Extension\AssetExtension::makeLinks(): Argument #1 ($text) must be of type string, null given, called in /home/username/domain.com/mautic/var/tmp/twig/ef/ef6787421501ecc99158046e98ee62ae.php on line 124 at /home/username/domain.com/mautic/app/bundles/CoreBundle/Twig/Extension/AssetExtension.php:166)”} {“hostname”:“iad1-shared-e1-06”,“pid”:447319}

---

<div class="post-metadata">

**Author:** ![dirk\_s](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/dirk_s/32/748_2.png) [@dirk\_s](https://forum.mautic.org/u/dirk_s)\
**Post date:** [April 13, 2024, 9:00am UTC](https://forum.mautic.org/t/critical-uncaught-php-exception-twig-error/31562/3 "2024-04-13T09:00:18Z")

</div>

Did you do a “clear:cache”? Also in installs across major releases and certain situations I needed to do a separate “mautic:assets:generate” via the console on the command line.

---

<div class="post-metadata">

**Author:** ![crozilla](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/crozilla/32/2054_2.png) [@crozilla](https://forum.mautic.org/u/crozilla)\
**Post date:** [April 13, 2024, 3:18pm UTC](https://forum.mautic.org/t/critical-uncaught-php-exception-twig-error/31562/4 "2024-04-13T15:18:00Z")

</div>

Yep, I did. Also, did m:a:g. But is there any harm in doing m:a:g again?

---

<div class="post-metadata">

**Author:** ![crozilla](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/crozilla/32/2054_2.png) [@crozilla](https://forum.mautic.org/u/crozilla)\
**Post date:** [April 14, 2024, 3:32pm UTC](https://forum.mautic.org/t/critical-uncaught-php-exception-twig-error/31562/5 "2024-04-14T15:32:54Z")

</div>

Okay, ran m:a:g again and cleared cache, no dice.

Noticed that node\_modules directory was somehow missing (wtf?) even though npm and nvm were both installed. Reinstalled them, then regenerated assets, and cleared cache, but still getting the same Twig error. Can’t view Lead/Points or Visit Published Pages reports.

Upgraded to 5.0.4 without issue. Same Twig error. Super weird.

---

<div class="post-metadata">

**Author:** ![juangadiel](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/juangadiel/32/11660_2.png) [@juangadiel](https://forum.mautic.org/u/juangadiel)\
**Post date:** [April 25, 2024, 3:01am UTC](https://forum.mautic.org/t/critical-uncaught-php-exception-twig-error/31562/6 "2024-04-25T03:01:10Z")

</div>

I’m also having the same error/exception when trying to view the default report “_Downloads of all Assets_” on a fresh installation. It is worth mention that the report has not been modified.

# Installation Details:

- **Docker image** : mautic/mautic:5-apache
- **Mautic version** : 5.0.4
- **PHP version** : 8.1.28
- **Database** : 11.3.2-MariaDB (pdo\_mysql)

# Steps to Reproduce:

1. On a fresh install, add an asset  
– Upload a local file (I tried with both .png and .jpg)  
– Do not alter/edit anything else and click on “Save & Close”  
– Copy the download URL
2. Generate a lead by opening the download URL of the newly created asset in a web browser (I used an incognito window on Brave browser)
3. Open the report “_Downloads of all Assets_”  
– A **500** Internal Server Error is thrown.

# PHP Error Log:

[2024-04-25T02:14:31.432973+00:00] mautic.CRITICAL: Uncaught PHP Exception Twig\Error\RuntimeError: “An exception has been thrown during the rendering of a template (“Mautic\CoreBundle\Twig\Extension\AssetExtension::makeLinks(): Argument #1 ($text) must be of type string, null given, called in /var/www/html/var/tmp/twig/82/8239dceed72df500b32440cab9d9a10c.php on line 125”).” at /var/www/html/docroot/app/bundles/ReportBundle/Resources/views/Graph/Table.html.twig line 37 {“exception”:“[object] (Twig\Error\RuntimeError(code: 0): An exception has been thrown during the rendering of a template ("Mautic\CoreBundle\Twig\Extension\AssetExtension::makeLinks(): Argument #1 ($text) must be of type string, null given, called in /var/www/html/var/tmp/twig/82/8239dceed72df500b32440cab9d9a10c.php on line 125"). at /var/www/html/docroot/app/bundles/ReportBundle/Resources/views/Graph/Table.html.twig:37)\n[previous exception] [object] (TypeError(code: 0): Mautic\CoreBundle\Twig\Extension\AssetExtension::makeLinks(): Argument #1 ($text) must be of type string, null given, called in /var/www/html/var/tmp/twig/82/8239dceed72df500b32440cab9d9a10c.php on line 125 at /var/www/html/docroot/app/bundles/CoreBundle/Twig/Extension/AssetExtension.php:166)”} {“hostname”:“mautic-web-ix-chart-84db4cdd65-zgbfj”,“pid”:23}

---

<div class="post-metadata">

**Author:** ![ddease2](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ddease2/32/13484_2.png) [@ddease2](https://forum.mautic.org/u/ddease2)\
**Post date:** [January 9, 2025, 9:38pm UTC](https://forum.mautic.org/t/critical-uncaught-php-exception-twig-error/31562/7 "2025-01-09T21:38:11Z")

</div>

Its been a while. Has any figured out this issue on this?

[2025-01-09T21:11:01.169607+00:00] mautic.WARNING: PHP Warning - SessionHandler::read(): open(/var/lib/php/sessions/sess\_uo0oj2c0aq16penk3qer9shd9t, O\_RDWR) failed: Permission denied (13) - in file /var/www/html/mautic/vendor/symfony/http-foundation/Session/Storage/Handler/StrictSessionHandler.php - at line 59 {“hostname”:“mautic”,“pid”:2524}  
[2025-01-09T21:11:01.169688+00:00] mautic.WARNING: PHP Warning - session\_start(): Failed to read session data: user (path: /var/lib/php/sessions) - in file /var/www/html/mautic/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php - at line 185 {“hostname”:“mautic”,“pid”:2524}  
[2025-01-09T21:11:01.169887+00:00] mautic.CRITICAL: Exception thrown when handling an exception (Twig\Error\RuntimeError: An exception has been thrown during the rendering of a template (“Failed to start the session.”). at /var/www/html/mautic/docroot/app/bundles/CoreBundle/Resources/views/Default/script.html.twig line 9) {“exception”:“[object] (Twig\Error\RuntimeError(code: 0): An exception has been thrown during the rendering of a template ("Failed to start the session."). at /var/www/html/mautic/docroot/app/bundles/CoreBundle/Resources/views/Default/script.html.twig:9)\n[previous exception] [object] (RuntimeException(code: 0): Failed to start the session. at /var/www/html/mautic/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php:186)”} {“hostname”:“mautic”,“pid”:2524}  
[2025-01-09T21:11:01.181501+00:00] mautic.ERROR: Twig\Error\RuntimeError: An exception has been thrown during the rendering of a template (“Failed to start the session.”). - in file /var/www/html/mautic/docroot/app/bundles/CoreBundle/Resources/views/Default/script.html.twig - at line 9 {“hostname”:“mautic”,“pid”:2524}

---

<div class="post-metadata">

**Author:** ![ncmon](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ncmon/32/11887_2.png) [@ncmon](https://forum.mautic.org/u/ncmon)\
**Post date:** [January 15, 2025, 7:08pm UTC](https://forum.mautic.org/t/critical-uncaught-php-exception-twig-error/31562/8 "2025-01-15T19:08:52Z")

</div>

I have similar problem. I find that when in form edit \> Successful Submit Action \> Remain at form is the only option that works. Other options redirect to **500** Internal Server Error.

[2025-01-15T19:05:06.139594+00:00] mautic.CRITICAL: Uncaught PHP Exception Twig\Error\LoaderError: “Unable to find template “@themes/@defaults/html/message.html.twig” (looked into: /website/public\_html/docroot/themes) in “@themes/blank/html/message.html.twig” at line 1.” at /website/public\_html/vendor/twig/twig/src/Loader/FilesystemLoader.php line 234 {“exception”:“[object] (Twig\Error\LoaderError(code: 0): Unable to find template "@themes/@defaults/html/message.html.twig" (looked into: /website/public\_html/docroot/themes) in "@themes/blank/html/message.html.twig" at line 1. at /website/public\_html/vendor/twig/twig/src/Loader/FilesystemLoader.php:234)”}

---

<div class="post-metadata">

**Author:** ![fkrafft](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/fkrafft/32/2220_2.png) [@fkrafft](https://forum.mautic.org/u/fkrafft)\
**Post date:** [January 17, 2025, 11:50am UTC](https://forum.mautic.org/t/critical-uncaught-php-exception-twig-error/31562/9 "2025-01-17T11:50:27Z")

</div>

@ncmon Same here, unable to find the template.

---

<div class="post-metadata">

**Author:** ![ddease2](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ddease2/32/13484_2.png) [@ddease2](https://forum.mautic.org/u/ddease2)\
**Post date:** [January 18, 2025, 2:35pm UTC](https://forum.mautic.org/t/critical-uncaught-php-exception-twig-error/31562/10 "2025-01-18T14:35:49Z")

</div>

I got past this by confirming all my file and directory permissions.

---

<div class="post-metadata">

**Author:** ![ncmon](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ncmon/32/11887_2.png) [@ncmon](https://forum.mautic.org/u/ncmon)\
**Post date:** [January 20, 2025, 4:55pm UTC](https://forum.mautic.org/t/critical-uncaught-php-exception-twig-error/31562/11 "2025-01-20T16:55:57Z")

</div>

I tried that and no success either. I re-do the form (new labels and names) and it’s working as expected. Can’t tell what the issue was but maybe it has something to do with Clone form as that is the only difference i have to the new form.

---

<div class="post-metadata">

**Author:** ![oshumake](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/oshumake/32/14105_2.png) [@oshumake](https://forum.mautic.org/u/oshumake)\
**Post date:** [June 12, 2025, 4:35pm UTC](https://forum.mautic.org/t/critical-uncaught-php-exception-twig-error/31562/12 "2025-06-12T16:35:55Z")

</div>

@juangadiel I am also recieving a similar error when tying to load or edit user profiles

_Installation Details:_

- List item Mautic Version: 5.2.3
- PHP version: 8.2.28
- Database: 8.0.37 (pdo\_mysql)

_Steps to Replicate:_  
Go to User Management  
Click on an affected user  
Expected: Able to edit the user’s details, including passwords  
Actual: cannot progress get an Error 500, Internal Server Error

Workaround: Create a new user  
Note other users Test, Mautic and Wood, Cat do not progress when selected

PHP Error Log: [2025-06-12T15:35:45.706237+00:00] mautic.CRITICAL: Uncaught PHP Exception Twig\Error\RuntimeError: “Key “0” does not exist as the sequence/mapping is empty.” at /srv/webdata/webroot/phoenixfutures/app/bundles/UserBundle/Resources/views/User/recent\_activity.html.twig line 146 {“exception”:“[object] (Twig\Error\RuntimeError(code: 0): Key "0" does not exist as the sequence/mapping is empty. at /srv/webdata/webroot/phoenixfutures/app/bundles/UserBundle/Resources/views/User/recent\_activity.html.twig:146)”} {“hostname”:“vidar”,“pid”:2954343}
