Error: Call to a member function checkIfEmpty() on null in Drupal\ai_automators\AiAutomatorEntityModifier->baseShouldSave()

Created on 13 October 2024, about 1 month ago

Problem/Motivation

Hi guys, I just updated to the latest version of the ai module, and had to restore a backup because when I triggered an automator by saving a new entity that has one enabled, the site crashed and I got the following error:

The website encountered an unexpected error. Try again later.

Error: Call to a member function checkIfEmpty() on null in Drupal\ai_automators\AiAutomatorEntityModifier->baseShouldSave() (line 261 of modules/contrib/ai/modules/ai_automators/src/AiAutomatorEntityModifier.php).

Drupal\ai_automators\AiAutomatorEntityModifier->markFieldForProcessing() (Line: 129)
Drupal\ai_automators\AiAutomatorEntityModifier->saveEntity() (Line: 31)
ai_automators_entity_presave()
call_user_func_array() (Line: 416)
Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}() (Line: 395)
Drupal\Core\Extension\ModuleHandler->invokeAllWith() (Line: 415)
Drupal\Core\Extension\ModuleHandler->invokeAll() (Line: 217)
Drupal\Core\Entity\EntityStorageBase->invokeHook() (Line: 900)
Drupal\Core\Entity\ContentEntityStorageBase->invokeHook() (Line: 529)
Drupal\Core\Entity\EntityStorageBase->doPreSave() (Line: 753)
Drupal\Core\Entity\ContentEntityStorageBase->doPreSave() (Line: 483)
Drupal\Core\Entity\EntityStorageBase->save() (Line: 806)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (Line: 354)
Drupal\Core\Entity\EntityBase->save() (Line: 46)
Drupal\eca_content\Plugin\Action\FieldUpdateActionBase->saveEntity() (Line: 138)
Drupal\eca_content\Plugin\Action\FieldUpdateActionBase->save() (Line: 440)
Drupal\eca_content\Plugin\Action\FieldUpdateActionBase->execute() (Line: 102)
Drupal\eca\Entity\Objects\EcaAction->execute() (Line: 210)
Drupal\eca\Processor->executeSuccessors() (Line: 212)
Drupal\eca\Processor->executeSuccessors() (Line: 212)
Drupal\eca\Processor->executeSuccessors() (Line: 212)
Drupal\eca\Processor->executeSuccessors() (Line: 168)
Drupal\eca\Processor->execute() (Line: 76)
Drupal\eca\EventSubscriber\EcaBase->onEvent()
call_user_func() (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() (Line: 73)
Drupal\eca\Event\TriggerEvent->dispatchFromPlugin() (Line: 111)
Drupal\eca_content\HookHandler->insert() (Line: 90)
eca_content_entity_insert()
call_user_func_array() (Line: 416)
Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}() (Line: 395)
Drupal\Core\Extension\ModuleHandler->invokeAllWith() (Line: 415)
Drupal\Core\Extension\ModuleHandler->invokeAll() (Line: 217)
Drupal\Core\Entity\EntityStorageBase->invokeHook() (Line: 900)
Drupal\Core\Entity\ContentEntityStorageBase->invokeHook() (Line: 564)
Drupal\Core\Entity\EntityStorageBase->doPostSave() (Line: 781)
Drupal\Core\Entity\ContentEntityStorageBase->doPostSave() (Line: 489)
Drupal\Core\Entity\EntityStorageBase->save() (Line: 806)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (Line: 354)
Drupal\Core\Entity\EntityBase->save() (Line: 293)
Drupal\Core\Entity\EntityForm->save() (Line: 38)
Drupal\eck\Form\Entity\EckEntityForm->save()
call_user_func_array() (Line: 129)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers() (Line: 67)
Drupal\Core\Form\FormSubmitter->doSubmitForm() (Line: 597)
Drupal\Core\Form\FormBuilder->processForm() (Line: 326)
Drupal\Core\Form\FormBuilder->buildForm() (Line: 48)
Drupal\Core\Entity\EntityFormBuilder->getForm() (Line: 75)
Drupal\eck\Controller\EckContentController->add()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 638)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 50)
Drupal\ban\BanMiddleware->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 741)
Drupal\Core\DrupalKernel->handle() (Line: 19)

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

1.0

Component

AI Automators

Created by

🇹🇭Thailand AlfTheCat

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

Comments & Activities

  • Issue created by @AlfTheCat
  • 🇩🇪Germany marcus_johansson

    Could you first try the following (if you didn't):
    1. Run either "drush updb" or the update.php page.
    2. Make sure to flush the cache.
    3. Make sure that AI Automators are enabled and not AI Automator (we did a name change).

    If that is done, could you please give back the following information:
    * What was the branch/commit you had before updating (if you know).
    * What is your current branch/commit according to composer.lock.
    * Which automator type on which field type.

  • 🇹🇭Thailand AlfTheCat

    Hi Marcus,

    Thanks for the quick reply. The automaton I ran (I didn't try other entities that have multiple automators) was the google_places automator.

    I did run updatedb and cr.

    Composer.lock holds this information related to the branch I was on (and now restored to again):

     {
                "name": "drupal/ai",
                "version": "dev-1.0.x",
                "source": {
                    "type": "git",
                    "url": "https://git.drupalcode.org/project/ai.git",
                    "reference": "8be49dd66b7ee604f826e0fb3b1fea16bb8f17ba"
                }
    

    Hope this helps, let me know if there's anything more I can provide.

  • 🇩🇪Germany marcus_johansson

    Could you give me the google_places version as well from composer.lock and I will try to replicate why it can't find it.

  • 🇹🇭Thailand AlfTheCat

    Hi Marcus,

    Sure, the Google places composer.lock info reads:

    {
                "name": "drupal/google_places",
                "version": "1.0.0-beta1",
                "source": {
                    "type": "git",
                    "url": "https://git.drupalcode.org/project/google_places.git",
                    "reference": "1.0.0-beta1"
                },
  • 🇩🇪Germany marcus_johansson

    Ah, I did not release the new version after the update to AI Automators. If you try composer update there should be beta2 now. It was prepared and I forgot... sorry about that.

  • 🇹🇭Thailand AlfTheCat

    Hi Marcus, no problem, and thanks for the guidance and the new release. I just updated and it works great again :)

  • 🇩🇪Germany marcus_johansson

    So I don't break your site again :) The AI dev branch will be connected to the Google Places dev branch. If you want to keep it stable for now use the alpha versions with the beta version.

    There will probably be a breaking change today again for AI Automators on dev branch, requiring dev branch of Google Places.

    Sorry for the inconvinience, but the API changes a lot when we add stuff and recognize that we need more flexibility - this change is so we can handle moderation states in the the Automators for instance. It will probably be so until its out of experimental state.

  • 🇹🇭Thailand AlfTheCat

    Thanks, I'll use the alpha version of AI with the beta of google_places. Life on the bleeding edge :)

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024