Cannot load the file entity with NULL ID - Create with AI page
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3521706. --> Reported by: [jeetmail72](https://www.drupal.org/user/3411867) Related to !133 !99 >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>The submodule <strong>ai_agents_form_integration</strong> of <strong>ai_agents</strong> module provides a CTA 'Create with AI' on the Manage Fields page of Node/Taxonomy/user.</p> <h4 id="summary-steps-reproduce">Steps to reproduce</h4> <p>1. Click on the Create with AI CTA on the manage fields page<br> 2. Enter the prompt and click on the Generate Fields<br> 3. The page will show the error</p> <p>The website encountered an unexpected error. Try again later.</p> <p>AssertionError: Cannot load the "file" entity with NULL ID. in assert() (line 261 of core/lib/Drupal/Core/Entity/EntityStorageBase.php).<br> Drupal\Core\Entity\EntityStorageBase-&gt;load() (Line: 158)<br> Drupal\ai_agents_form_integration\Form\FieldTypeCreation-&gt;submitForm()<br> call_user_func_array() (Line: 105)<br> Drupal\Core\Form\FormSubmitter-&gt;executeSubmitHandlers() (Line: 43)<br> Drupal\Core\Form\FormSubmitter-&gt;doSubmitForm() (Line: 589)<br> Drupal\Core\Form\FormBuilder-&gt;processForm() (Line: 144)<br> Drupal\autosave_form\Form\AutosaveFormBuilder-&gt;processForm() (Line: 321)<br> Drupal\Core\Form\FormBuilder-&gt;buildForm() (Line: 97)<br> Drupal\autosave_form\Form\AutosaveFormBuilder-&gt;buildForm() (Line: 73)<br> Drupal\Core\Controller\FormController-&gt;getContentResult()<br> call_user_func_array() (Line: 123)<br> Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber-&gt;Drupal\Core\EventSubscriber\{closure}() (Line: 593)<br> Drupal\Core\Render\Renderer-&gt;executeInRenderContext() (Line: 121)<br> Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber-&gt;wrapControllerExecutionInRenderContext() (Line: 97)<br> Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber-&gt;Drupal\Core\EventSubscriber\{closure}() (Line: 183)<br> Symfony\Component\HttpKernel\HttpKernel-&gt;handleRaw() (Line: 76)<br> Symfony\Component\HttpKernel\HttpKernel-&gt;handle() (Line: 53)<br> Drupal\Core\StackMiddleware\Session-&gt;handle() (Line: 48)<br> Drupal\Core\StackMiddleware\KernelPreHandle-&gt;handle() (Line: 28)<br> Drupal\Core\StackMiddleware\ContentLength-&gt;handle() (Line: 32)<br> Drupal\big_pipe\StackMiddleware\ContentLength-&gt;handle() (Line: 116)<br> Drupal\page_cache\StackMiddleware\PageCache-&gt;pass() (Line: 90)<br> Drupal\page_cache\StackMiddleware\PageCache-&gt;handle() (Line: 48)<br> Drupal\Core\StackMiddleware\ReverseProxyMiddleware-&gt;handle() (Line: 51)<br> Drupal\Core\StackMiddleware\NegotiationMiddleware-&gt;handle() (Line: 36)<br> Drupal\Core\StackMiddleware\AjaxPageState-&gt;handle() (Line: 51)<br> Drupal\Core\StackMiddleware\StackedHttpKernel-&gt;handle() (Line: 709)<br> Drupal\Core\DrupalKernel-&gt;handle() (Line: 19)</p> <p>4. The upload document is showing an error on the file upload<br> Drupal\Component\Plugin\Exception\PluginNotFoundException: The "file_validate_extensions" plugin does not exist.</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <p>1. Check if the file is uploaded and fetch the file contents<br> 2. Add the proper validation for the uploaded file<br> 3. Fix the route name in the Batch finish() when redirecting</p> <h3 id="summary-remaining-tasks">Remaining tasks</h3> <p>N/A</p> <h3 id="summary-ui-changes">User interface changes</h3> <p>No</p> <h3 id="summary-api-changes">API changes</h3> <p>No</p> <h3 id="summary-data-model-changes">Data model changes</h3> <p>No</p>
issue