"Argument 1 passed to Drupal\Core\Field\WidgetBase::errorElement() must be of the type array, null given' when creating an unpublished node

Created on 18 September 2016, about 8 years ago
Updated 23 January 2024, 10 months ago

1. Goto content - Create - article
2. Feel the fields
3. press "save and unpublish"
4. get error

Recoverable fatal error: Argument 1 passed to Drupal\Core\Field\WidgetBase::errorElement() must be of the type array, null given, called in /home/hooligan.site/web/hooligan.site/public_html/core/lib/Drupal/Core/Field/WidgetBase.php on line 439 and defined in Drupal\Core\Field\WidgetBase->errorElement() (line 498 of /home/hooligan.site/web/hooligan.site/public_html/core/lib/Drupal/Core/Field/WidgetBase.php) #0 /home/hooligan.site/web/hooligan.site/public_html/core/includes/bootstrap.inc(546): _drupal_error_handler_real(4096, 'Argument 1 pass...', '/home/hooligan....', 498, Array) #1 /home/hooligan.site/web/hooligan.site/public_html/core/lib/Drupal/Core/Field/WidgetBase.php(498): _drupal_error_handler(4096, 'Argument 1 pass...', '/home/hooligan....', 498, Array) #2 /home/hooligan.site/web/hooligan.site/public_html/core/lib/Drupal/Core/Field/WidgetBase.php(439): Drupal\Core\Field\WidgetBase->errorElement(NULL, Object(Symfony\Component\Validator\ConstraintViolation), Array, Object(Drupal\Core\Form\FormState)) #3 /home/hooligan.site/web/hooligan.site/public_html/core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php(255): Drupal\Core\Field\WidgetBase->flagErrors(Object(Drupal\content_moderation\Plugin\Field\ModerationStateFieldItemList), Object(Symfony\Component\Validator\ConstraintViolationList), Array, Object(Drupal\Core\Form\FormState)) #4 /home/hooligan.site/web/hooligan.site/public_html/core/lib/Drupal/Core/Entity/ContentEntityForm.php(157): Drupal\Core\Entity\Entity\EntityFormDisplay->flagWidgetsErrorsFromViolations(Object(Drupal\Core\Entity\EntityConstraintViolationList), Array, Object(Drupal\Core\Form\FormState)) #5 /home/hooligan.site/web/hooligan.site/public_html/core/lib/Drupal/Core/Entity/ContentEntityForm.php(103): Drupal\Core\Entity\ContentEntityForm->flagViolations(Object(Drupal\Core\Entity\EntityConstraintViolationList), Array, Object(Drupal\Core\Form\FormState)) #6 [internal function]: Drupal\Core\Entity\ContentEntityForm->validateForm(Array, Object(Drupal\Core\Form\FormState)) #7 /home/hooligan.site/web/hooligan.site/public_html/core/lib/Drupal/Core/Form/FormValidator.php(83): call_user_func_array(Array, Array) #8 /home/hooligan.site/web/hooligan.site/public_html/core/lib/Drupal/Core/Form/FormValidator.php(270): Drupal\Core\Form\FormValidator->executeValidateHandlers(Array, Object(Drupal\Core\Form\FormState)) #9 /home/hooligan.site/web/hooligan.site/public_html/core/lib/Drupal/Core/Form/FormValidator.php(119): Drupal\Core\Form\FormValidator->doValidateForm(Array, Object(Drupal\Core\Form\FormState), 'node_article_fo...') #10 /home/hooligan.site/web/hooligan.site/public_html/core/lib/Drupal/Core/Form/FormBuilder.php(569): Drupal\Core\Form\FormValidator->validateForm('node_article_fo...', Array, Object(Drupal\Core\Form\FormState)) #11 /home/hooligan.site/web/hooligan.site/public_html/core/lib/Drupal/Core/Form/FormBuilder.php(314): Drupal\Core\Form\FormBuilder->processForm('node_article_fo...', Array, Object(Drupal\Core\Form\FormState)) #12 /home/hooligan.site/web/hooligan.site/public_html/core/lib/Drupal/Core/Entity/EntityFormBuilder.php(48): Drupal\Core\Form\FormBuilder->buildForm(Object(Drupal\node\NodeForm), Object(Drupal\Core\Form\FormState)) #13 /home/hooligan.site/web/hooligan.site/public_html/core/modules/node/src/Controller/NodeController.php(113): Drupal\Core\Entity\EntityFormBuilder->getForm(Object(Drupal\node\Entity\Node)) #14 [internal function]: Drupal\node\Controller\NodeController->add(Object(Drupal\node\Entity\NodeType)) #15 /home/hooligan.site/web/hooligan.site/public_html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array) #16 /home/hooligan.site/web/hooligan.site/public_html/core/lib/Drupal/Core/Render/Renderer.php(574): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #17 /home/hooligan.site/web/hooligan.site/public_html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #18 /home/hooligan.site/web/hooligan.site/public_html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) #19 [internal function]: Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #20 /home/hooligan.site/web/hooligan.site/public_html/vendor/symfony/http-kernel/HttpKernel.php(139): call_user_func_array(Object(Closure), Array) #21 /home/hooligan.site/web/hooligan.site/public_html/vendor/symfony/http-kernel/HttpKernel.php(62): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #22 /home/hooligan.site/web/hooligan.site/public_html/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #23 /home/hooligan.site/web/hooligan.site/public_html/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #24 /home/hooligan.site/web/hooligan.site/public_html/core/modules/page_cache/src/StackMiddleware/PageCache.php(99): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #25 /home/hooligan.site/web/hooligan.site/public_html/core/modules/page_cache/src/StackMiddleware/PageCache.php(78): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) #26 /home/hooligan.site/web/hooligan.site/public_html/core/modules/ban/src/BanMiddleware.php(50): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #27 /home/hooligan.site/web/hooligan.site/public_html/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\ban\BanMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #28 /home/hooligan.site/web/hooligan.site/public_html/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(50): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #29 /home/hooligan.site/web/hooligan.site/public_html/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #30 /home/hooligan.site/web/hooligan.site/public_html/core/lib/Drupal/Core/DrupalKernel.php(649): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #31 /home/hooligan.site/web/hooligan.site/public_html/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #32 {main}.

if uninstall module then all ok

🐛 Bug report
Status

Active

Version

9.5

Component
Entity 

Last updated about 4 hours ago

Created by

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇫🇮Finland heikkiy Oulu

    We also encountered this problem. In our case the error happened when we were syncing configurations between two Drupal sites and we had an taxonomy term reference field.

    The entity reference field was generated correctly but it was missing the field setting for vocabularies that can be referenced. This broke saving the node and the error from this issue happened.

    We were able to solve the issue by editing the field configurations in the content type and selecting the correct vocabulary.

Production build 0.71.5 2024