Warning on AI Automator Run Order Resort
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3508615. -->
Reported by: [anjaliprasannan](https://www.drupal.org/user/3637917)
Related to !476
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>I am getting the below warning message when you have no ai automator enabled to the content type fields.</p>
<p>Warning: foreach() argument must be of type array|object, string given in Drupal\ai_automators\Form\AiChainForm->submitForm() (line 252 of modules/contrib/ai/modules/ai_automators/src/Form/AiChainForm.php).</p>
<p>Call Stack:</p>
<p>Drupal\ai_automators\Form\AiChainForm->submitForm()<br>
call_user_func_array() (Line: 105)<br>
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers() (Line: 43)<br>
Drupal\Core\Form\FormSubmitter->doSubmitForm() (Line: 589)<br>
Drupal\Core\Form\FormBuilder->processForm() (Line: 321)<br>
Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)<br>
Drupal\Core\Controller\FormController->getContentResult()<br>
call_user_func_array() (Line: 123)<br>
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 593)<br>
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121)<br>
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)<br>
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (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: 32)<br>
Drupal\big_pipe\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: 709)<br>
Drupal\Core\DrupalKernel->handle() (Line: 19)</p>
<h4 id="summary-steps-reproduce">Steps to reproduce</h4>
<ul>
<li>Once you have enabled the ai automator module</li>
<li>go to /admin/structure/types/manage/article/automator_chain</li>
<li>Click on Re-sort button</li>
<li>you get the warning message.</li>
</ul>
<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