Entity form: build entity - Incompatible with address field?
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3548576. -->
Reported by: [sunlix](https://www.drupal.org/user/1515828)
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>I have a content type with an address field on it.<br>
Building an entity during a "Validate form" event throws this error.</p>
<p>It may be an error in address but because it is triggered via an ECA model I want to preclude that the Action is missing something.</p>
<pre>TypeError: end(): Argument #1 ($array) must be of type array, null given in end() (line 403 of modules/contrib/address/src/Element/Address.php).<br><br>Drupal\address\Element\Address::clearValues()<br>call_user_func_array() (Line: 1085)<br>Drupal\Core\Form\FormBuilder->doBuildForm() (Line: 154)<br>Drupal\autosave_form\Form\AutosaveFormBuilder->doBuildForm() (Line: 1077)<br>Drupal\Core\Form\FormBuilder->doBuildForm() (Line: 154)<br>Drupal\autosave_form\Form\AutosaveFormBuilder->doBuildForm() (Line: 1077)<br>Drupal\Core\Form\FormBuilder->doBuildForm() (Line: 154)<br>Drupal\autosave_form\Form\AutosaveFormBuilder->doBuildForm() (Line: 1077)<br>Drupal\Core\Form\FormBuilder->doBuildForm() (Line: 154)<br>Drupal\autosave_form\Form\AutosaveFormBuilder->doBuildForm() (Line: 1077)<br>Drupal\Core\Form\FormBuilder->doBuildForm() (Line: 154)<br>Drupal\autosave_form\Form\AutosaveFormBuilder->doBuildForm() (Line: 571)<br>Drupal\Core\Form\FormBuilder->processForm() (Line: 144)<br>Drupal\autosave_form\Form\AutosaveFormBuilder->processForm() (Line: 172)<br>Drupal\eca_form\Plugin\Action\FormBuildEntity->execute() (Line: 107)<br>Drupal\eca\Entity\Objects\EcaAction->execute() (Line: 298)<br>Drupal\eca\Processor->executeSuccessors() (Line: 222)<br>Drupal\eca\Processor->execute() (Line: 69)<br>Drupal\eca\EventSubscriber\DynamicSubscriber->onEvent() (Line: 206)<br>Symfony\Component\EventDispatcher\EventDispatcher->callListeners() (Line: 56)<br>Symfony\Component\EventDispatcher\EventDispatcher->dispatch() (Line: 66)<br>Drupal\eca\Event\TriggerEvent->dispatchFromPlugin() (Line: 253)<br>Drupal\eca_form\Hook\FormHooks::validate()<br>call_user_func_array() (Line: 82)<br>Drupal\Core\Form\FormValidator->executeValidateHandlers() (Line: 275)<br>Drupal\Core\Form\FormValidator->doValidateForm() (Line: 118)<br>Drupal\Core\Form\FormValidator->validateForm() (Line: 69)<br>Drupal\autosave_form\Form\AutosaveFormValidator->validateForm() (Line: 585)<br>Drupal\Core\Form\FormBuilder->processForm() (Line: 144)<br>Drupal\autosave_form\Form\AutosaveFormBuilder->processForm() (Line: 321)<br>Drupal\Core\Form\FormBuilder->buildForm() (Line: 97)<br>Drupal\autosave_form\Form\AutosaveFormBuilder->buildForm() (Line: 73)<br>Drupal\Core\Controller\FormController->getContentResult()<br>call_user_func_array() (Line: 123)<br>Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->{closure:Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber::wrapControllerExecutionInRenderContext():121}() (Line: 627)<br>Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121)<br>Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)<br>Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->{closure:Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber::onController():96}() (Line: 183)<br>Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)<br>Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)<br>Drupal\Core\StackMiddleware\Session->handle() (Line: 48)<br>Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)<br>Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 116)<br>Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 90)<br>Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)<br>Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)<br>Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 53)<br>Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)<br>Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 715)<br>Drupal\Core\DrupalKernel->handle() (Line: 19)</pre><h4 id="summary-steps-reproduce">Steps to reproduce</h4>
<p>Create a content type with an address field on it (<a href="https://www.drupal.org/project/address">https://www.drupal.org/project/address</a>)<br>
Create a model with "Validate form" event and chain just a "Entity form: build entity" action.</p>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<h3 id="summary-remaining-tasks">Remaining tasks</h3>
<h3 id="summary-ui-changes">User interface changes</h3>
<h3 id="summary-api-changes">API changes</h3>
<h3 id="summary-data-model-changes">Data model changes</h3>
issue