Scanning exception on site theme

Created on 25 October 2023, 11 months ago
Updated 26 October 2023, 11 months ago

I am receiving a "500 Internal Server Error" message when scanning my site's custom theme. I did not receive this initially, and was able to see a number of things in my theme that needed upgrading for Drupal 10. But upon re-scanning I am getting this error. I have reverted all changes to my theme, and the error persists.

I see this error in the database log.

ypeError: Twig\Node\Expression\FunctionExpression::__construct(): Argument #3 ($lineno) must be of type int, Twig\Node\Node given, called in /app/vendor/twig/twig/src/ExpressionParser.php on line 565 in Twig\Node\Expression\FunctionExpression->__construct() (line 19 of /app/vendor/twig/twig/src/Node/Expression/FunctionExpression.php)
#0 /app/vendor/twig/twig/src/ExpressionParser.php(565): Twig\Node\Expression\FunctionExpression->__construct('Twig\\Node\\Expre...', Object(Twig\Node\Expression\ConstantExpression), Object(Twig\Node\Node), 42, NULL)
#1 /app/vendor/twig/twig/src/ExpressionParser.php(548): Twig\ExpressionParser->parseFilterExpressionRaw(Object(Twig\Node\Expression\FilterExpression))
#2 /app/vendor/twig/twig/src/ExpressionParser.php(406): Twig\ExpressionParser->parseFilterExpression(Object(Twig\Node\Expression\GetAttrExpression))
#3 /app/vendor/twig/twig/src/ExpressionParser.php(289): Twig\ExpressionParser->parsePostfixExpression(Object(Twig\Node\Expression\GetAttrExpression))
#4 /app/vendor/twig/twig/src/ExpressionParser.php(175): Twig\ExpressionParser->parsePrimaryExpression()
#5 /app/vendor/twig/twig/src/ExpressionParser.php(70): Twig\ExpressionParser->getPrimary()
#6 /app/vendor/twig/twig/src/ExpressionParser.php(389): Twig\ExpressionParser->parseExpression()
#7 /app/vendor/twig/twig/src/ExpressionParser.php(281): Twig\ExpressionParser->parseHashExpression()
#8 /app/vendor/twig/twig/src/ExpressionParser.php(175): Twig\ExpressionParser->parsePrimaryExpression()
#9 /app/vendor/twig/twig/src/ExpressionParser.php(70): Twig\ExpressionParser->getPrimary()
#10 /app/vendor/twig/twig/src/ExpressionParser.php(338): Twig\ExpressionParser->parseExpression()
#11 /app/vendor/twig/twig/src/ExpressionParser.php(279): Twig\ExpressionParser->parseArrayExpression()
#12 /app/vendor/twig/twig/src/ExpressionParser.php(175): Twig\ExpressionParser->parsePrimaryExpression()
#13 /app/vendor/twig/twig/src/ExpressionParser.php(70): Twig\ExpressionParser->getPrimary()
#14 /app/vendor/twig/twig/src/ExpressionParser.php(677): Twig\ExpressionParser->parseExpression()
#15 /app/vendor/twig/twig/src/TokenParser/SetTokenParser.php(38): Twig\ExpressionParser->parseMultitargetExpression()
#16 /app/vendor/twig/twig/src/Parser.php(184): Twig\TokenParser\SetTokenParser->parse(Object(Twig\Token))
#17 /app/vendor/twig/twig/src/Parser.php(97): Twig\Parser->subparse(NULL, false)
#18 /app/vendor/twig/twig/src/Environment.php(562): Twig\Parser->parse(Object(Twig\TokenStream))
#19 /app/vendor/twig/twig/src/Util/DeprecationCollector.php(67): Twig\Environment->parse(Object(Twig\TokenStream))
#20 /app/web/modules/composer/upgrade_status/src/TwigDeprecationAnalyzer.php(65): Twig\Util\DeprecationCollector->collect(Object(Twig\Util\TemplateDirIterator))
#21 /app/web/modules/composer/upgrade_status/src/TwigDeprecationAnalyzer.php(44): Drupal\upgrade_status\TwigDeprecationAnalyzer->collectDeprecations('themes/custom/n...')
#22 /app/web/modules/composer/upgrade_status/src/DeprecationAnalyzer.php(411): Drupal\upgrade_status\TwigDeprecationAnalyzer->analyze(Object(Drupal\Core\Extension\Extension))
#23 /app/web/modules/composer/upgrade_status/src/Controller/ScanResultController.php(138): Drupal\upgrade_status\DeprecationAnalyzer->analyze(Object(Drupal\Core\Extension\Extension))
#24 [internal function]: Drupal\upgrade_status\Controller\ScanResultController->analyze('nec')
#25 /app/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#26 /app/web/core/lib/Drupal/Core/Render/Renderer.php(580): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#27 /app/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#28 /app/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#29 /app/vendor/symfony/http-kernel/HttpKernel.php(169): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#30 /app/vendor/symfony/http-kernel/HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#31 /app/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#32 /app/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#33 /app/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#34 /app/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#35 /app/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#36 /app/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#37 /app/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#38 /app/web/core/lib/Drupal/Core/DrupalKernel.php(718): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#39 /app/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#40 {main}
πŸ› Bug report
Status

Active

Version

4.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States srdtwc Skokie, IL

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @srdtwc
  • πŸ‡ΊπŸ‡ΈUnited States srdtwc Skokie, IL

    Some more detail: this error seems to only happen when the custom theme is the only theme or module left on the site with D10 incompatible code. If I introduce a D10 incompatible issue to another module and rescan, then I am able to see all the issues (20 in total) with my custom theme and no 500 errors are reported.

    So it seems like this is an edge case when there is a single module (or maybe just a theme?) left.

Production build 0.71.5 2024