Ajax 500 error, unable to add sections on Drupal 10.2.3

Created on 29 February 2024, 10 months ago
Updated 13 August 2024, 4 months ago

Problem/Motivation

I'm running into hard-to-debug ajax errors (Oops, something went wrong. Check your browser's developer console for more details.) using layout builder on a number of sites seemingly all after upgrading to Drupal 10.2.3. When trying to debug a site where adding new sections no longer worked, I was able to trace that particular issue back to gin_lb and trigger a watchdog entry.

TypeError: explode(): Argument #2 ($string) must be of type string, Drupal\Core\Template\AttributeArray given in explode() (line 90 of /var/www/XXX/modules/contrib/gin_lb/src/TwigExtension/GinLbExtension.php).

Stack trace:

#0 /var/www/XXX/modules/contrib/gin_lb/src/TwigExtension/GinLbExtension.php(90): explode()
#1 /var/www/XXX/sites/default/files/php/twig/65e0ac86109eb_textarea--gin-lb.html.twi_b9svKI7KZNAMtg8y_OPmODGvX/YPyBHL61Yvs3ldzmbyLPAwBIY85RoOG9ZV5m-kGE3Ik.php(44): Drupal\gin_lb\TwigExtension\GinLbExtension->ginClasses()
#2 /var/www/XXX/vendor/twig/twig/src/Template.php(394): __TwigTemplate_64404b307d57ae7e244fde907e701214->doDisplay()
#3 /var/www/XXX/vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling()
#4 /var/www/XXX/vendor/twig/twig/src/Template.php(379): Twig\Template->display()
#5 /var/www/XXX/vendor/twig/twig/src/TemplateWrapper.php(38): Twig\Template->render()
#6 /var/www/XXX/core/themes/engines/twig/twig.engine(39): Twig\TemplateWrapper->render()
#7 /var/www/XXX/core/lib/Drupal/Core/Theme/ThemeManager.php(348): twig_render_template()
#8 /var/www/XXX/core/lib/Drupal/Core/Render/Renderer.php(480): Drupal\Core\Theme\ThemeManager->render()
#9 /var/www/XXX/core/lib/Drupal/Core/Render/Renderer.php(493): Drupal\Core\Render\Renderer->doRender()
#10 /var/www/XXX/core/lib/Drupal/Core/Render/Renderer.php(493): Drupal\Core\Render\Renderer->doRender()
#11 /var/www/XXX/core/lib/Drupal/Core/Render/Renderer.php(240): Drupal\Core\Render\Renderer->doRender()
#12 /var/www/XXX/core/lib/Drupal/Core/Render/Renderer.php(153): Drupal\Core\Render\Renderer->render()
#13 /var/www/XXX/core/lib/Drupal/Core/Render/Renderer.php(627): Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}()
#14 /var/www/XXX/core/lib/Drupal/Core/Render/Renderer.php(152): Drupal\Core\Render\Renderer->executeInRenderContext()
#15 /var/www/XXX/core/lib/Drupal/Core/Render/MainContent/OffCanvasRenderer.php(56): Drupal\Core\Render\Renderer->renderRoot()
#16 /var/www/XXX/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\OffCanvasRenderer->renderResponse()
#17 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray()
#18 /var/www/XXX/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func()
#19 /var/www/XXX/vendor/symfony/http-kernel/HttpKernel.php(186): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch()
#20 /var/www/XXX/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#21 /var/www/XXX/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle()
#22 /var/www/XXX/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#23 /var/www/XXX/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#24 /var/www/XXX/core/modules/ban/src/BanMiddleware.php(50): Drupal\big_pipe\StackMiddleware\ContentLength->handle()
#25 /var/www/XXX/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\ban\BanMiddleware->handle()
#26 /var/www/XXX/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#27 /var/www/XXX/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#28 /var/www/XXX/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle()
#29 /var/www/XXX/core/lib/Drupal/Core/DrupalKernel.php(704): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
#30 /var/www/XXX/index.php(19): Drupal\Core\DrupalKernel->handle()
#31 {main}

Steps to reproduce

In my case, I upgraded to Drupal 10.2.3 and was faced with this error when attempting to add a section to a new user entity layout.
Uninstalling gin_lb resolved the issue.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡ΉπŸ‡­Thailand AlfTheCat

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024