Add AI Agent is not working

Created on 20 May 2025, 3 months ago

Problem/Motivation

When you try to add a new AI Agent the site breaks with the next error:

Error: Call to a member function newInstance() on null in Drupal\ai\Plugin\AiFunctionCall\Derivative\ActionPluginDeriver->resolveRootDataType() (line 183 of modules/contrib/ai/src/Plugin/AiFunctionCall/Derivative/ActionPluginDeriver.php).

Steps to reproduce

1. Install latest version of Drupal AI Agents module - 1.1.0-beta2
2. Go to AI Agents Settings โ†’ page
3. Click on + Add AI Agent โ†’ button

๐Ÿ› Bug report
Status

Active

Version

1.1

Component

Code

Created by

๐Ÿ‡ช๐Ÿ‡ธSpain gxleano Cรกceres

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

Comments & Activities

  • Issue created by @gxleano
  • ๐Ÿ‡จ๐Ÿ‡ฆCanada RobLoach Earth

    Pushed up a change over at https://www.drupal.org/project/ai/issues/3525540 ๐Ÿ› Error: Call to a member function newInstance() with ActionPluginDeriver Active ... May not be the best solution around it though. Merge Request: https://git.drupalcode.org/project/ai/-/merge_requests/624

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia annmarysruthy

    Followed the steps mentioned , installed ai agents 1.1.0-beta2 but unable to replicate the error. able to add new agent.

    This might be environment-specific or related to a missing or misconfigured dependency. Might help if the reporter shares more details like core AI module version or any custom code involved.

  • ๐Ÿ‡ช๐Ÿ‡ธSpain gxleano Cรกceres

    Testing in a clean installation with Drupal 10.4.7 and 1.1.x AI stack and everything works fine.

    Seems like some module from the other installation is interfering on this.

    Closing the issue.

  • Status changed to Closed: works as designed 2 days ago
  • ๐Ÿ‡ฒ๐Ÿ‡ฆMorocco lakhal

    Hey

    I got also this error when I tried to add an agent:

    AI agent Version: 1.1.2
    AI Core Version: 1.1.2
    Drupal Version 11.2.3

    I got an error and warning message when I click on "add agent"

    Error

    Message	Error: Call to a member function newInstance() on null in Drupal\ai\Plugin\AiFunctionCall\Derivative\ActionPluginDeriver->resolveRootDataType() (line 183 of /bitnami/drupal/modules/contrib/ai/src/Plugin/AiFunctionCall/Derivative/ActionPluginDeriver.php).
    Severity	Error
    Operations	
    Backtrace	
    #0 /bitnami/drupal/modules/contrib/ai/src/Plugin/AiFunctionCall/Derivative/ActionPluginDeriver.php(162): Drupal\ai\Plugin\AiFunctionCall\Derivative\ActionPluginDeriver->resolveRootDataType()
    #1 /bitnami/drupal/modules/contrib/ai/src/Plugin/AiFunctionCall/Derivative/ActionPluginDeriver.php(78): Drupal\ai\Plugin\AiFunctionCall\Derivative\ActionPluginDeriver->getContextDefinitions()
    #2 /opt/bitnami/drupal/core/lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php(101): Drupal\ai\Plugin\AiFunctionCall\Derivative\ActionPluginDeriver->getDerivativeDefinitions()
    #3 /opt/bitnami/drupal/core/lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php(87): Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDerivatives()
    #4 /opt/bitnami/drupal/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php(340): Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDefinitions()
    #5 /bitnami/drupal/modules/contrib/ai/src/Service/FunctionCalling/FunctionCallPluginManager.php(33): Drupal\Core\Plugin\DefaultPluginManager->findDefinitions()
    #6 /bitnami/drupal/modules/contrib/ai_agents/src/Form/AiAgentForm.php(244): Drupal\ai\Service\FunctionCalling\FunctionCallPluginManager->getDefinitions()
    #7 /opt/bitnami/drupal/core/lib/Drupal/Core/Entity/EntityForm.php(107): Drupal\ai_agents\Form\AiAgentForm->form()
    #8 [internal function]: Drupal\Core\Entity\EntityForm->buildForm()
    #9 /opt/bitnami/drupal/core/lib/Drupal/Core/Form/FormBuilder.php(528): call_user_func_array()
    #10 /opt/bitnami/drupal/core/lib/Drupal/Core/Form/FormBuilder.php(279): Drupal\Core\Form\FormBuilder->retrieveForm()
    #11 /opt/bitnami/drupal/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm()
    #12 [internal function]: Drupal\Core\Controller\FormController->getContentResult()
    #13 /opt/bitnami/drupal/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
    #14 /opt/bitnami/drupal/core/lib/Drupal/Core/Render/Renderer.php(627): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
    #15 /opt/bitnami/drupal/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(121): Drupal\Core\Render\Renderer->executeInRenderContext()
    #16 /opt/bitnami/drupal/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
    #17 /opt/bitnami/drupal/vendor/symfony/http-kernel/HttpKernel.php(183): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
    #18 /opt/bitnami/drupal/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
    #19 /opt/bitnami/drupal/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle()
    #20 /opt/bitnami/drupal/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
    #21 /opt/bitnami/drupal/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
    #22 /opt/bitnami/drupal/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle()
    #23 /opt/bitnami/drupal/core/modules/page_cache/src/StackMiddleware/PageCache.php(116): Drupal\big_pipe\StackMiddleware\ContentLength->handle()
    #24 /opt/bitnami/drupal/core/modules/page_cache/src/StackMiddleware/PageCache.php(90): Drupal\page_cache\StackMiddleware\PageCache->pass()
    #25 /opt/bitnami/drupal/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle()
    #26 /opt/bitnami/drupal/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
    #27 /opt/bitnami/drupal/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(53): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
    #28 /opt/bitnami/drupal/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle()
    #29 /opt/bitnami/drupal/core/lib/Drupal/Core/DrupalKernel.php(715): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
    #30 /opt/bitnami/drupal/index.php(19): Drupal\Core\DrupalKernel->handle()
    #31 {main}
    

    Warning

    Warning: Undefined array key 0 in Drupal\ai\Plugin\AiFunctionCall\Derivative\ActionPluginDeriver->resolveRootDataType() (line 183 of /bitnami/drupal/modules/contrib/ai/src/Plugin/AiFunctionCall/Derivative/ActionPluginDeriver.php)
    #0 /opt/bitnami/drupal/core/includes/bootstrap.inc(104): _drupal_error_handler_real()
    #1 /bitnami/drupal/modules/contrib/ai/src/Plugin/AiFunctionCall/Derivative/ActionPluginDeriver.php(183): _drupal_error_handler()
    #2 /bitnami/drupal/modules/contrib/ai/src/Plugin/AiFunctionCall/Derivative/ActionPluginDeriver.php(162): Drupal\ai\Plugin\AiFunctionCall\Derivative\ActionPluginDeriver->resolveRootDataType()
    #3 /bitnami/drupal/modules/contrib/ai/src/Plugin/AiFunctionCall/Derivative/ActionPluginDeriver.php(78): Drupal\ai\Plugin\AiFunctionCall\Derivative\ActionPluginDeriver->getContextDefinitions()
    #4 /opt/bitnami/drupal/core/lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php(101): Drupal\ai\Plugin\AiFunctionCall\Derivative\ActionPluginDeriver->getDerivativeDefinitions()
    #5 /opt/bitnami/drupal/core/lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php(87): Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDerivatives()
    #6 /opt/bitnami/drupal/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php(340): Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDefinitions()
    #7 /bitnami/drupal/modules/contrib/ai/src/Service/FunctionCalling/FunctionCallPluginManager.php(33): Drupal\Core\Plugin\DefaultPluginManager->findDefinitions()
    #8 /bitnami/drupal/modules/contrib/ai_agents/src/Form/AiAgentForm.php(244): Drupal\ai\Service\FunctionCalling\FunctionCallPluginManager->getDefinitions()
    #9 /opt/bitnami/drupal/core/lib/Drupal/Core/Entity/EntityForm.php(107): Drupal\ai_agents\Form\AiAgentForm->form()
    #10 [internal function]: Drupal\Core\Entity\EntityForm->buildForm()
    #11 /opt/bitnami/drupal/core/lib/Drupal/Core/Form/FormBuilder.php(528): call_user_func_array()
    #12 /opt/bitnami/drupal/core/lib/Drupal/Core/Form/FormBuilder.php(279): Drupal\Core\Form\FormBuilder->retrieveForm()
    #13 /opt/bitnami/drupal/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm()
    #14 [internal function]: Drupal\Core\Controller\FormController->getContentResult()
    #15 /opt/bitnami/drupal/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
    #16 /opt/bitnami/drupal/core/lib/Drupal/Core/Render/Renderer.php(627): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
    #17 /opt/bitnami/drupal/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(121): Drupal\Core\Render\Renderer->executeInRenderContext()
    #18 /opt/bitnami/drupal/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
    #19 /opt/bitnami/drupal/vendor/symfony/http-kernel/HttpKernel.php(183): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
    #20 /opt/bitnami/drupal/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
    #21 /opt/bitnami/drupal/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle()
    #22 /opt/bitnami/drupal/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
    #23 /opt/bitnami/drupal/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
    #24 /opt/bitnami/drupal/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle()
    #25 /opt/bitnami/drupal/core/modules/page_cache/src/StackMiddleware/PageCache.php(116): Drupal\big_pipe\StackMiddleware\ContentLength->handle()
    #26 /opt/bitnami/drupal/core/modules/page_cache/src/StackMiddleware/PageCache.php(90): Drupal\page_cache\StackMiddleware\PageCache->pass()
    #27 /opt/bitnami/drupal/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle()
    #28 /opt/bitnami/drupal/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
    #29 /opt/bitnami/drupal/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(53): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
    #30 /opt/bitnami/drupal/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle()
    #31 /opt/bitnami/drupal/core/lib/Drupal/Core/DrupalKernel.php(715): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
    #32 /opt/bitnami/drupal/index.php(19): Drupal\Core\DrupalKernel->handle()
    #33 {main}
    
Production build 0.71.5 2024