TypeError: Drupal\ai_automator\PluginBaseClasses\RuleBase::__construct(): Argument #1 ($pluginManager) must be of type Drupal\ai\AiProviderPluginManager

Created on 19 September 2024, 2 months ago

Problem/Motivation

Hi,

I enabled this module and now all address fields are broken and I'm unable to add new ones. Trying to edit them results in a WSOD.

#0 /var/www/****/modules/contrib/google_places/src/Plugin/AiAutomatorType/AddressFieldFromText.php(65): Drupal\ai_automator\PluginBaseClasses\RuleBase->__construct()
#1 /var/www/****/modules/contrib/google_places/src/Plugin/AiAutomatorType/AddressFieldFromText.php(73): Drupal\google_places\Plugin\AiAutomatorType\AddressFieldFromText->__construct()
#2 /var/www/****/core/lib/Drupal/Core/Plugin/Factory/ContainerFactory.php(21): Drupal\google_places\Plugin\AiAutomatorType\AddressFieldFromText::create()
#3 /var/www/****/core/lib/Drupal/Component/Plugin/PluginManagerBase.php(83): Drupal\Core\Plugin\Factory\ContainerFactory->createInstance()
#4 /var/www/****/modules/contrib/ai/modules/ai_automator/src/AiFieldRules.php(57): Drupal\Component\Plugin\PluginManagerBase->createInstance()
#5 /var/www/****/modules/contrib/ai/modules/ai_automator/src/FormAlter/AiAutomatorFieldConfig.php(129): Drupal\ai_automator\AiFieldRules->findRuleCandidates()
#6 /var/www/****/modules/contrib/ai/modules/ai_automator/ai_automator.module(16): Drupal\ai_automator\FormAlter\AiAutomatorFieldConfig->alterForm()
#7 /var/www/****/core/lib/Drupal/Core/Extension/ModuleHandler.php(552): ai_automator_form_field_config_edit_form_alter()
#8 /var/www/****/core/lib/Drupal/Core/Form/FormBuilder.php(834): Drupal\Core\Extension\ModuleHandler->alter()
#9 /var/www/****/core/lib/Drupal/Core/Form/FormBuilder.php(285): Drupal\Core\Form\FormBuilder->prepareForm()
#10 /var/www/****/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm()
#11 /var/www/****/core/modules/layout_builder/src/Controller/LayoutBuilderHtmlEntityFormController.php(39): Drupal\Core\Controller\FormController->getContentResult()
#12 [internal function]: Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController->getContentResult()
#13 /var/www/****/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
#14 /var/www/****/core/lib/Drupal/Core/Render/Renderer.php(638): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#15 /var/www/****/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(121): Drupal\Core\Render\Renderer->executeInRenderContext()
#16 /var/www/****/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
#17 /var/www/****/vendor/symfony/http-kernel/HttpKernel.php(181): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#18 /var/www/****/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#19 /var/www/****/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle()
#20 /var/www/****/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#21 /var/www/****/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#22 /var/www/****/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle()
#23 /var/www/****/core/modules/ban/src/BanMiddleware.php(50): Drupal\big_pipe\StackMiddleware\ContentLength->handle()
#24 /var/www/****/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\ban\BanMiddleware->handle()
#25 /var/www/****/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#26 /var/www/****/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#27 /var/www/****/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle()
#28 /var/www/****/core/lib/Drupal/Core/DrupalKernel.php(741): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
#29 /var/www/****/index.php(19): Drupal\Core\DrupalKernel->handle()
#30 {main}

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

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
  • Assigned to marcus_johansson
  • Status changed to Fixed 2 months ago
  • 🇩🇪Germany marcus_johansson

    Fixed and tested, first beta release is coming up with this fixed.

  • 🇹🇭Thailand AlfTheCat

    Hi Marcus, great, the error is gone. I had to uninstall the module and re-install but it's indeed fixed.

    Also, and this is a more general issue with AI automators, when a field is set to use AI automator, it has to be saved twice.

    In this case, initially, an error appears on the field edit page:
    Warning: Undefined array key "automator_ai_model" in Drupal\ai_automator\PluginBaseClasses\RuleBase->extraAdvancedFormFields() (line 189 of modules/contrib/ai/modules/ai_automator/src/PluginBaseClasses/RuleBase.php).

    When saving a node, the site crashes and displays:

    StatusText: 500 Service unavailable (with message)
    ResponseText: The website encountered an unexpected error. Try again later.TypeError: Drupal\ai\Base\AiProviderClientBase::getAvailableConfiguration(): Argument #2 ($model_id) must be of type string, null given in Drupal\ai\Base\AiProviderClientBase->getAvailableConfiguration() (line 309 of modules/contrib/ai/src/Base/AiProviderClientBase.php). ReflectionMethod->invokeArgs() (Line: 109)
    Drupal\ai\Plugin\ProviderProxy->wrapperCall() (Line: 81)
    Drupal\ai\Plugin\ProviderProxy->__call() (Line: 437)
    Drupal\ai_automator\PluginBaseClasses\RuleBase->prepareLlmInstance() (Line: 103)
    Drupal\google_places\Plugin\AiAutomatorType\AddressFieldFromText->generate() (Line: 70)
    Drupal\ai_automator\AiAutomatorRuleRunner->generateResponse() (Line: 25)
    Drupal\ai_automator\Batch\ProcessField::saveField() (Line: 296)
    _batch_process() (Line: 138)
    _batch_do() (Line: 94)
    _batch_page() (Line: 52)
    Drupal\system\Controller\BatchController->batchPage()
    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)

    When re-saving the field configurations the errors are gone. Actually saving information from Google places is not working, but that is a separate issue which I will open now.

  • 🇩🇪Germany marcus_johansson

    The second error mentioned in the comment should also be fixed now.

  • 🇹🇭Thailand AlfTheCat

    Awesome, I'll update and test in a few hours.

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

Production build 0.71.5 2024