Twig error when oppening an order in admin view

Created on 27 January 2025, 3 days ago

Opening an order throws this message:

Twig\Error\SyntaxError: The text to be translated with "trans" can only contain references to simple variables in "__string_template__71e2a2e26def06bd1af37619c4da164c" at line 1 in Drupal\Core\Template\TwigTransTokenParser->checkTransString() (Zeile 108 in /var/www/vhosts/example.com/core/lib/Drupal/Core/Template/TwigTransTokenParser.php).

#0 /var/www/vhosts/example.com/core/lib/Drupal/Core/Template/TwigTransTokenParser.php(57): Drupal\Core\Template\TwigTransTokenParser->checkTransString()
#1 /var/www/vhosts/example.com/vendor/twig/twig/src/Parser.php(174): Drupal\Core\Template\TwigTransTokenParser->parse()
#2 /var/www/vhosts/example.com/vendor/twig/twig/src/Parser.php(83): Twig\Parser->subparse()
#3 /var/www/vhosts/example.com/vendor/twig/twig/src/Environment.php(523): Twig\Parser->parse()
#4 /var/www/vhosts/example.com/vendor/twig/twig/src/Environment.php(551): Twig\Environment->parse()
#5 /var/www/vhosts/example.com/core/lib/Drupal/Core/Template/TwigEnvironment.php(131): Twig\Environment->compileSource()
#6 /var/www/vhosts/example.com/vendor/twig/twig/src/Environment.php(381): Drupal\Core\Template\TwigEnvironment->compileSource()
#7 /var/www/vhosts/example.com/vendor/twig/twig/src/Environment.php(432): Twig\Environment->loadTemplate()
#8 /var/www/vhosts/example.com/core/lib/Drupal/Core/Template/TwigEnvironment.php(234): Twig\Environment->createTemplate()
#9 /var/www/vhosts/example.com/core/lib/Drupal/Core/Render/Element/InlineTemplate.php(54): Drupal\Core\Template\TwigEnvironment->renderInline()
#10 [internal function]: Drupal\Core\Render\Element\InlineTemplate::preRenderInlineTemplate()
#11 /var/www/vhosts/example.com/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(113): call_user_func_array()
#12 /var/www/vhosts/example.com/core/lib/Drupal/Core/Render/Renderer.php(870): Drupal\Core\Render\Renderer->doTrustedCallback()
#13 /var/www/vhosts/example.com/core/lib/Drupal/Core/Render/Renderer.php(432): Drupal\Core\Render\Renderer->doCallback()
#14 /var/www/vhosts/example.com/core/lib/Drupal/Core/Render/Renderer.php(248): Drupal\Core\Render\Renderer->doRender()
#15 /var/www/vhosts/example.com/core/modules/views/src/Plugin/views/field/FieldPluginBase.php(1204): Drupal\Core\Render\Renderer->render()
#16 /var/www/vhosts/example.com/core/modules/views/views.theme.inc(238): Drupal\views\Plugin\views\field\FieldPluginBase->advancedRender()
#17 [internal function]: template_preprocess_views_view_field()
#18 /var/www/vhosts/example.com/core/lib/Drupal/Core/Theme/ThemeManager.php(261): call_user_func_array()
#19 /var/www/vhosts/example.com/core/lib/Drupal/Core/Render/Renderer.php(491): Drupal\Core\Theme\ThemeManager->render()
#20 /var/www/vhosts/example.com/core/lib/Drupal/Core/Render/Renderer.php(248): Drupal\Core\Render\Renderer->doRender()
#21 /var/www/vhosts/example.com/core/modules/views/src/Plugin/views/field/FieldPluginBase.php(1796): Drupal\Core\Render\Renderer->render()
#22 /var/www/vhosts/example.com/core/modules/views/src/Plugin/views/style/StylePluginBase.php(767): Drupal\views\Plugin\views\field\FieldPluginBase->theme()
#23 [internal function]: Drupal\views\Plugin\views\style\StylePluginBase->elementPreRenderRow()
#24 /var/www/vhosts/example.com/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(113): call_user_func_array()
#25 /var/www/vhosts/example.com/core/lib/Drupal/Core/Render/Renderer.php(870): Drupal\Core\Render\Renderer->doTrustedCallback()
#26 /var/www/vhosts/example.com/core/lib/Drupal/Core/Render/Renderer.php(432): Drupal\Core\Render\Renderer->doCallback()
#27 /var/www/vhosts/example.com/core/lib/Drupal/Core/Render/Renderer.php(248): Drupal\Core\Render\Renderer->doRender()
#28 /var/www/vhosts/example.com/core/modules/views/src/Plugin/views/style/StylePluginBase.php(706): Drupal\Core\Render\Renderer->render()
#29 /var/www/vhosts/example.com/core/modules/views/src/Plugin/views/style/StylePluginBase.php(572): Drupal\views\Plugin\views\style\StylePluginBase->renderFields()
#30 /var/www/vhosts/example.com/core/modules/views/src/Plugin/views/style/StylePluginBase.php(460): Drupal\views\Plugin\views\style\StylePluginBase->renderGrouping()
#31 /var/www/vhosts/example.com/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php(2177): Drupal\views\Plugin\views\style\StylePluginBase->render()
#32 /var/www/vhosts/example.com/core/modules/views/src/ViewExecutable.php(1593): Drupal\views\Plugin\views\display\DisplayPluginBase->render()
#33 /var/www/vhosts/example.com/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php(2467): Drupal\views\ViewExecutable->render()
#34 /var/www/vhosts/example.com/core/modules/views/src/ViewExecutable.php(1722): Drupal\views\Plugin\views\display\DisplayPluginBase->preview()
#35 /var/www/vhosts/example.com/core/modules/views/src/Element/View.php(66): Drupal\views\ViewExecutable->preview()
#36 [internal function]: Drupal\views\Element\View::preRenderViewElement()
#37 /var/www/vhosts/example.com/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(113): call_user_func_array()
#38 /var/www/vhosts/example.com/core/lib/Drupal/Core/Render/Renderer.php(870): Drupal\Core\Render\Renderer->doTrustedCallback()
#39 /var/www/vhosts/example.com/core/lib/Drupal/Core/Render/Renderer.php(432): Drupal\Core\Render\Renderer->doCallback()
#40 /var/www/vhosts/example.com/core/lib/Drupal/Core/Render/Renderer.php(248): Drupal\Core\Render\Renderer->doRender()
#41 /var/www/vhosts/example.com/core/lib/Drupal/Core/Template/TwigExtension.php(484): Drupal\Core\Render\Renderer->render()
#42 /var/www/vhosts/example.com/vendor/twig/twig/src/Environment.php(391) : eval()'d code(75): Drupal\Core\Template\TwigExtension->escapeFilter()
#43 /var/www/vhosts/example.com/vendor/twig/twig/src/Template.php(393): __TwigTemplate_dc6b0ce5bf4a251b8a3eb592d0c20c3a->doDisplay()
#44 /var/www/vhosts/example.com/vendor/twig/twig/src/Template.php(349): Twig\Template->yield()
#45 /var/www/vhosts/example.com/vendor/twig/twig/src/Template.php(364): Twig\Template->display()
#46 /var/www/vhosts/example.com/vendor/twig/twig/src/TemplateWrapper.php(35): Twig\Template->render()
#47 /var/www/vhosts/example.com/core/themes/engines/twig/twig.engine(33): Twig\TemplateWrapper->render()
#48 /var/www/vhosts/example.com/core/lib/Drupal/Core/Theme/ThemeManager.php(348): twig_render_template()
#49 /var/www/vhosts/example.com/core/lib/Drupal/Core/Render/Renderer.php(491): Drupal\Core\Theme\ThemeManager->render()
#50 /var/www/vhosts/example.com/core/lib/Drupal/Core/Render/Renderer.php(248): Drupal\Core\Render\Renderer->doRender()
#51 /var/www/vhosts/example.com/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(238): Drupal\Core\Render\Renderer->render()
#52 /var/www/vhosts/example.com/core/lib/Drupal/Core/Render/Renderer.php(638): Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}()
#53 /var/www/vhosts/example.com/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(231): Drupal\Core\Render\Renderer->executeInRenderContext()
#54 /var/www/vhosts/example.com/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(128): Drupal\Core\Render\MainContent\HtmlRenderer->prepare()
#55 /var/www/vhosts/example.com/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse()
#56 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray()
#57 /var/www/vhosts/example.com/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func()
#58 /var/www/vhosts/example.com/vendor/symfony/http-kernel/HttpKernel.php(186): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch()
#59 /var/www/vhosts/example.com/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#60 /var/www/vhosts/example.com/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle()
#61 /var/www/vhosts/example.com/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#62 /var/www/vhosts/example.com/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#63 /var/www/vhosts/example.com/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\ContentLength->handle()
#64 /var/www/vhosts/example.com/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
#65 /var/www/vhosts/example.com/core/modules/ban/src/BanMiddleware.php(50): Drupal\page_cache\StackMiddleware\PageCache->handle()
#66 /var/www/vhosts/example.com/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\ban\BanMiddleware->handle()
#67 /var/www/vhosts/example.com/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#68 /var/www/vhosts/example.com/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#69 /var/www/vhosts/example.com/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle()
#70 /var/www/vhosts/example.com/core/lib/Drupal/Core/DrupalKernel.php(741): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
#71 /var/www/vhosts/example.com/index.php(19): Drupal\Core\DrupalKernel->handle()
#72 {main}

Steps to reproduce

Drupal 10.3.10
Commerce Core 8.x-2.40

?

https://example.com/admin/commerce/orders/xxx
with error, but
https://example.com/admin/commerce/orders/xxx/edit
is ok.

🐛 Bug report
Status

Active

Version

2.40

Component

Order

Created by

🇩🇪Germany umac_de

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

Comments & Activities

  • Issue created by @umac_de
  • 🇩🇪Germany umac_de

    As far as I can see the sentence in question is

    Payment captured via gateway for amount using method.
    Transaction ID: remote_id.

    and the problem is "method".
    TwigTransTokenParser.php >> $body as $node:

    Twig\Node\IfNode
    tag:
    if nodes:
    tests: Twig\Node\Node
    nodes:
    0: Twig\Node\Expression\NameExpression
    attributes:
    name: 'method'
    is_defined_test: false
    ignore_strict_check: false
    always_defined: false
    1: Twig\Node\Node
    nodes:
    0: Twig\Node\TextNode
    attributes:
    data: ' using '
    1: Twig\Node\PrintNode
    nodes:
    expr: Twig\Node\Expression\NameExpression
    attributes:
    name: 'method'
    is_defined_test: false
    ignore_strict_check: false
    always_defined: false
    2: Twig\Node\TextNode
    attributes: data: '
    '

Production build 0.71.5 2024