Issue Bug Closed

#102939Unable to identify fluid template file from exception stack trace

Christian Weiske 01/26/24, 10:14 updated 08/16/26, 12:03

Description

During development I got an exception in a fluid template, but the exception stack trace is totally useless for determining which fluid template is causing the problem.

The beginning is this (rest of the trace is in the attachment trace2.txt):

(1/1) #1351584844 TYPO3Fluid\Fluid\Core\ViewHelper\Exception
An argument "key" or "id" has to be provided
   in /var/www/typo3/vendor/typo3/cms-fluid/Classes/ViewHelpers/TranslateViewHelper.php line 150
at TYPO3\CMS\Fluid\ViewHelpers\TranslateViewHelper::renderStatic()
   in /var/www/typo3/vendor/typo3fluid/fluid/src/Core/ViewHelper/Traits/CompileWithRenderStatic.php line 31
at TYPO3\CMS\Fluid\ViewHelpers\TranslateViewHelper->render()
at call_user_func()
   in /var/www/typo3/vendor/typo3fluid/fluid/src/Core/ViewHelper/AbstractViewHelper.php line 256
at TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper->callRenderMethod()
   in /var/www/typo3/vendor/typo3fluid/fluid/src/Core/ViewHelper/AbstractViewHelper.php line 244
at TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper->initializeArgumentsAndRender()
   in /var/www/typo3/vendor/typo3fluid/fluid/src/Core/ViewHelper/ViewHelperInvoker.php line 79
at TYPO3Fluid\Fluid\Core\ViewHelper\ViewHelperInvoker->invoke()
   in /var/www/typo3/vendor/typo3fluid/fluid/src/Core/Parser/SyntaxTree/ViewHelperNode.php line 135

This goes on and on for 161 .php files, not nowhere is the actual fluid template file mentioned that causes it.

Please make exception stack traces more useful for debugging fluid templates.

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

Files 1

History 4

  1. Christian Kuhn commented <span data-processor="relativetime" data-value="2024-01-26T18:21:55+00:00" > 01/26/24, 18:21 </span>

    Quick hack: This is more easy to see when you reload, since it will then trigger rendering from within the ‘compiled’ template file, and you can determine the actual template from that filename rather easily.

    AND we cleaned up those template files a lot with recent fluid standalone releases, so it is relatively easy to match that to the exact spot in the template (tipp: use “Code” -> “Reformat Code” in phpstorm to get the file into a relatively well nested form, which reduces mental load mapping a specific place in that file to the template even more).

  2. Christian Kuhn commented <span data-processor="relativetime" data-value="2024-01-26T18:30:11+00:00" > 01/26/24, 18:30 </span>

    How to really change it? I have no idea … template files are of course not executed as such, and i think there is currently no direct place where the filename is hand over to a method in the backtrace.

    What I planned to do in fluid at some point is that the template file cache is always created first, and always executed directly, not only with the second call and beyond. fluid standalone does not do this, since it may run without caches, too. I already thought about requiring a working cache system to always execute the “PHP-form” of templates … but that’s a bit more work and we need to have a look at the impact in fluid standalone before doing this.

  3. Georg Ringer commented and changed status New Closed <span data-processor="relativetime" data-value="2026-08-16T12:03:58+00:00" > 08/16/26, 12:03 </span>

    this has been improved in TYPO3 14 a lot, example
    TYPO3Fluid\Fluid\Core\ViewHelper\Exception in /var/www/html/typo3/sysext/backend/Resources/Private/Layouts/Module.fluid.html: TYPO3Fluid\Fluid\Core\ViewHelper\Exception in /var/www/html/typo3/sysext/backend/Resources/Private/Templates/SiteConfiguration/Overview.fluid.html: TYPO3Fluid\Fluid\Core\ViewHelper\MissingArgumentException in /var/www/html/typo3/sysext/backend/Resources/Private/Templates/SiteConfiguration/Overview.fluid.html: An argument "key" or "id" has to be provided (/var/www/html/typo3/sysext/fluid/Classes/ViewHelpers/TranslateViewHelper.php:101) (/var/www/html/vendor/typo3fluid/fluid/src/Core/ErrorHandler/StandardErrorHandler.php:35) (/var/www/html/vendor/typo3fluid/fluid/src/Core/ErrorHandler/StandardErrorHandler.php:35)

    closing it now