Error message when using the AI Assistant to add a content type
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3539557. -->
Reported by: [mandclu](https://www.drupal.org/user/52136)
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>I used the AI Assistant to add a content type for posting movie reviews, as outlined in this video:<br>
<a href="https://drive.google.com/file/d/1pr5ez7iEognzK4XGONwNs0wvGu_nINMO/view?usp=sharing">https://drive.google.com/file/d/1pr5ez7iEognzK4XGONwNs0wvGu_nINMO/view?usp=sharing</a></p>
<p>Every time it creates the content type, there is an error like this:</p>
<pre>Warning: Undefined array key "field_name" in Drupal\Core\Field\BaseFieldDefinition->getName() (line 111 of /var/www/html/web/core/lib/Drupal/Core/Field/BaseFieldDefinition.php)<br>#0 /var/www/html/web/core/includes/bootstrap.inc(104): _drupal_error_handler_real()<br>#1 /var/www/html/web/core/lib/Drupal/Core/Field/BaseFieldDefinition.php(111): _drupal_error_handler()<br>#2 /var/www/html/web/core/modules/options/src/Plugin/Field/FieldType/ListItemBase.php(148): Drupal\Core\Field\BaseFieldDefinition->getName()<br>#3 /var/www/html/web/core/modules/options/src/Plugin/Field/FieldType/ListIntegerItem.php(87): Drupal\options\Plugin\Field\FieldType\ListItemBase->storageSettingsForm()<br>#4 /var/www/html/web/modules/contrib/ai_agents/src/Plugin/AiFunctionCall/GetFieldStorageForm.php(132): Drupal\options\Plugin\Field\FieldType\ListIntegerItem->storageSettingsForm()<br>#5 /var/www/html/web/modules/contrib/ai_agents/src/PluginBase/AiAgentEntityWrapper.php(935): Drupal\ai_agents\Plugin\AiFunctionCall\GetFieldStorageForm->execute()<br>#6 /var/www/html/web/modules/contrib/ai_agents/src/PluginBase/AiAgentEntityWrapper.php(423): Drupal\ai_agents\PluginBase\AiAgentEntityWrapper->executeTool()<br>#7 /var/www/html/web/modules/contrib/ai_agents/src/PluginBase/AiAgentEntityWrapper.php(486): Drupal\ai_agents\PluginBase\AiAgentEntityWrapper->determineSolvability()<br>#8 /var/www/html/web/modules/contrib/ai_agents/src/Plugin/AiFunctionCall/AiAgentWrapper.php(175): Drupal\ai_agents\PluginBase\AiAgentEntityWrapper->determineSolvability()<br>#9 /var/www/html/web/modules/contrib/ai_agents/src/PluginBase/AiAgentEntityWrapper.php(935): Drupal\ai_agents\Plugin\AiFunctionCall\AiAgentWrapper->execute()<br>#10 /var/www/html/web/modules/contrib/ai_agents/src/PluginBase/AiAgentEntityWrapper.php(423): Drupal\ai_agents\PluginBase\AiAgentEntityWrapper->executeTool()<br>#11 /var/www/html/web/modules/contrib/ai/modules/ai_assistant_api/src/Service/AgentRunner.php(73): Drupal\ai_agents\PluginBase\AiAgentEntityWrapper->determineSolvability()<br>#12 /var/www/html/web/modules/contrib/ai/modules/ai_assistant_api/src/AiAssistantApiRunner.php(316): Drupal\ai_assistant_api\Service\AgentRunner->runAsAgent()<br>#13 /var/www/html/web/modules/contrib/ai/modules/ai_chatbot/src/Controller/DeepChatApi.php(169): Drupal\ai_assistant_api\AiAssistantApiRunner->process()<br>#14 [internal function]: Drupal\ai_chatbot\Controller\DeepChatApi->api()<br>#15 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()<br>#16 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(622): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()<br>#17 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(121): Drupal\Core\Render\Renderer->executeInRenderContext()<br>#18 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()<br>#19 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(183): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()<br>#20 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()<br>#21 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle()<br>#22 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()<br>#23 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle()<br>#24 /var/www/html/web/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle()<br>#25 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(116): Drupal\big_pipe\StackMiddleware\ContentLength->handle()<br>#26 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(90): Drupal\page_cache\StackMiddleware\PageCache->pass()<br>#27 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle()<br>#28 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()<br>#29 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(53): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()<br>#30 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle()<br>#31 /var/www/html/web/core/lib/Drupal/Core/DrupalKernel.php(715): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()<br>#32 /var/www/html/web/index.php(19): Drupal\Core\DrupalKernel->handle()<br>#33 {main}</pre><h4 id="summary-steps-reproduce">Steps to reproduce (required for bugs, but not feature requests)</h4>
<p>Please provide information like AI modules enabled, which AI provider, browser, etc.<br>
On a fresh copy of Drupal CMS, install the AI recipe. Ask the assistant to add a content type for posting movie reviews.</p>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<p>The content type seems to (mostly) work as expected, so this seems to be a problem with setting the field label.</p>
issue