Errors when AI assistant has RAG Access Checks enabled

Created on 4 March 2025, about 1 month ago

When I use the "RAG Access check" setting on my AI assistants, I receive an error for everyone except site administrators. The assistants work correctly and are able to use the RAG database correctly until this setting is enabled.

After enabling this setting, anyone without the administrator role receives an error when entering anything into the website assistant.

There are no access restrictions preventing the user from accessing the indexed content. I have verified that users can manually access the content, but the AI assistant receives an error.

I have only indexed one type of content, with 3 content items. I can reproduce this with any AI assistant simply by enabling the RAG Access Check setting. Thanks in advance for any help!!

When the error occurs, I receive the following 3 messages in my site logs related to this:
------------------------------
------------------------------
Type ai_assistant_api
Date Tuesday, March 4, 2025 - 10:42 am
Location /api/deepchat?token=2DBhE-6apAUl2Rk6RAjj97mG3pNk1CXJZDQl82ZoMqA
Message Failed to search: The "" entity type does not exist.
Severity Error
------------------------------
------------------------------
Type php
Date Tuesday, March 4, 2025 - 10:42 am
User Human (not verified)
Location /api/deepchat?token=2DBhE-6apAUl2Rk6RAjj97mG3pNk1CXJZDQl82ZoMqA
Message Warning: Undefined array key 1 in Drupal\ai\Base\AiVdbProviderClientBase->isMultiple() (line 383 of /var/www/html/website/web/modules/contrib/ai/src/Base/AiVdbProviderClientBase.php)
#0 /var/www/html/website/web/core/includes/bootstrap.inc(166): _drupal_error_handler_real()
#1 /var/www/html/website/web/modules/contrib/ai/src/Base/AiVdbProviderClientBase.php(383): _drupal_error_handler()
#2 /var/www/html/website/web/modules/contrib/ai_vdb_provider_milvus/src/Plugin/VdbProvider/MilvusProvider.php(540): Drupal\ai\Base\AiVdbProviderClientBase->isMultiple()
#3 /var/www/html/website/web/modules/contrib/ai_vdb_provider_milvus/src/Plugin/VdbProvider/MilvusProvider.php(533): Drupal\ai_vdb_provider_milvus\Plugin\VdbProvider\MilvusProvider->processConditionGroup()
#4 /var/www/html/website/web/modules/contrib/ai_vdb_provider_milvus/src/Plugin/VdbProvider/MilvusProvider.php(506): Drupal\ai_vdb_provider_milvus\Plugin\VdbProvider\MilvusProvider->processConditionGroup()
#5 /var/www/html/website/web/modules/contrib/ai/modules/ai_search/src/Plugin/search_api/backend/SearchApiAiSearchBackend.php(413): Drupal\ai_vdb_provider_milvus\Plugin\VdbProvider\MilvusProvider->prepareFilters()
#6 /var/www/html/website/web/modules/contrib/search_api/src/Entity/Server.php(483): Drupal\ai_search\Plugin\search_api\backend\SearchApiAiSearchBackend->search()
#7 /var/www/html/website/web/modules/contrib/search_api/src/Query/Query.php(549): Drupal\search_api\Entity\Server->search()
#8 /var/www/html/website/web/modules/contrib/ai/modules/ai_search/src/Plugin/AiAssistantAction/RagAction.php(320): Drupal\search_api\Query\Query->execute()
#9 /var/www/html/website/web/modules/contrib/ai/modules/ai_search/src/Plugin/AiAssistantAction/RagAction.php(221): Drupal\ai_search\Plugin\AiAssistantAction\RagAction->getRagResults()
#10 /var/www/html/website/web/modules/contrib/ai/modules/ai_search/src/Plugin/AiAssistantAction/RagAction.php(155): Drupal\ai_search\Plugin\AiAssistantAction\RagAction->searchRagAction()
#11 /var/www/html/website/web/modules/contrib/ai/modules/ai_assistant_api/src/AiAssistantApiRunner.php(340): Drupal\ai_search\Plugin\AiAssistantAction\RagAction->triggerAction()
#12 /var/www/html/website/web/modules/contrib/ai/modules/ai_chatbot/src/Controller/DeepChatApi.php(154): Drupal\ai_assistant_api\AiAssistantApiRunner->process()
#13 [internal function]: Drupal\ai_chatbot\Controller\DeepChatApi->api()
#14 /var/www/html/website/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
#15 /var/www/html/website/web/core/lib/Drupal/Core/Render/Renderer.php(638): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#16 /var/www/html/website/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(121): Drupal\Core\Render\Renderer->executeInRenderContext()
#17 /var/www/html/website/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
#18 /var/www/html/website/vendor/symfony/http-kernel/HttpKernel.php(181): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#19 /var/www/html/website/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#20 /var/www/html/website/web/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle()
#21 /var/www/html/website/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#22 /var/www/html/website/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#23 /var/www/html/website/web/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle()
#24 /var/www/html/website/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(116): Drupal\big_pipe\StackMiddleware\ContentLength->handle()
#25 /var/www/html/website/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(90): Drupal\page_cache\StackMiddleware\PageCache->pass()
#26 /var/www/html/website/web/modules/contrib/advban/src/AdvbanMiddleware.php(57): Drupal\page_cache\StackMiddleware\PageCache->handle()
#27 /var/www/html/website/web/core/modules/ban/src/BanMiddleware.php(50): Drupal\advban\AdvbanMiddleware->handle()
#28 /var/www/html/website/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\ban\BanMiddleware->handle()
#29 /var/www/html/website/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#30 /var/www/html/website/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#31 /var/www/html/website/web/modules/contrib/remove_http_headers/src/StackMiddleware/RemoveHttpHeadersMiddleware.php(49): Drupal\Core\StackMiddleware\AjaxPageState->handle()
#32 /var/www/html/website/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\remove_http_headers\StackMiddleware\RemoveHttpHeadersMiddleware->handle()
#33 /var/www/html/website/web/core/lib/Drupal/Core/DrupalKernel.php(741): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
#34 /var/www/html/website/web/index.php(19): Drupal\Core\DrupalKernel->handle()
#35 {main}
Severity Warning
------------------------------
------------------------------
Type php
Date Tuesday, March 4, 2025 - 10:42 am
Location /api/deepchat?token=2DBhE-6apAUl2Rk6RAjj97mG3pNk1CXJZDQl82ZoMqA
Message Deprecated function: explode(): Passing null to parameter #2 ($string) of type string is deprecated in Drupal\ai\Base\AiVdbProviderClientBase->isMultiple() (line 383 of /var/www/html/website/web/modules/contrib/ai/src/Base/AiVdbProviderClientBase.php)
#0 /var/www/html/website/web/core/includes/bootstrap.inc(166): _drupal_error_handler_real()
#1 [internal function]: _drupal_error_handler()
#2 /var/www/html/website/web/modules/contrib/ai/src/Base/AiVdbProviderClientBase.php(383): explode()
#3 /var/www/html/website/web/modules/contrib/ai_vdb_provider_milvus/src/Plugin/VdbProvider/MilvusProvider.php(540): Drupal\ai\Base\AiVdbProviderClientBase->isMultiple()
#4 /var/www/html/website/web/modules/contrib/ai_vdb_provider_milvus/src/Plugin/VdbProvider/MilvusProvider.php(533): Drupal\ai_vdb_provider_milvus\Plugin\VdbProvider\MilvusProvider->processConditionGroup()
#5 /var/www/html/website/web/modules/contrib/ai_vdb_provider_milvus/src/Plugin/VdbProvider/MilvusProvider.php(506): Drupal\ai_vdb_provider_milvus\Plugin\VdbProvider\MilvusProvider->processConditionGroup()
#6 /var/www/html/website/web/modules/contrib/ai/modules/ai_search/src/Plugin/search_api/backend/SearchApiAiSearchBackend.php(413): Drupal\ai_vdb_provider_milvus\Plugin\VdbProvider\MilvusProvider->prepareFilters()
#7 /var/www/html/website/web/modules/contrib/search_api/src/Entity/Server.php(483): Drupal\ai_search\Plugin\search_api\backend\SearchApiAiSearchBackend->search()
#8 /var/www/html/website/web/modules/contrib/search_api/src/Query/Query.php(549): Drupal\search_api\Entity\Server->search()
#9 /var/www/html/website/web/modules/contrib/ai/modules/ai_search/src/Plugin/AiAssistantAction/RagAction.php(320): Drupal\search_api\Query\Query->execute()
#10 /var/www/html/website/web/modules/contrib/ai/modules/ai_search/src/Plugin/AiAssistantAction/RagAction.php(221): Drupal\ai_search\Plugin\AiAssistantAction\RagAction->getRagResults()
#11 /var/www/html/website/web/modules/contrib/ai/modules/ai_search/src/Plugin/AiAssistantAction/RagAction.php(155): Drupal\ai_search\Plugin\AiAssistantAction\RagAction->searchRagAction()
#12 /var/www/html/website/web/modules/contrib/ai/modules/ai_assistant_api/src/AiAssistantApiRunner.php(340): Drupal\ai_search\Plugin\AiAssistantAction\RagAction->triggerAction()
#13 /var/www/html/website/web/modules/contrib/ai/modules/ai_chatbot/src/Controller/DeepChatApi.php(154): Drupal\ai_assistant_api\AiAssistantApiRunner->process()
#14 [internal function]: Drupal\ai_chatbot\Controller\DeepChatApi->api()
#15 /var/www/html/website/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
#16 /var/www/html/website/web/core/lib/Drupal/Core/Render/Renderer.php(638): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#17 /var/www/html/website/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(121): Drupal\Core\Render\Renderer->executeInRenderContext()
#18 /var/www/html/website/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
#19 /var/www/html/website/vendor/symfony/http-kernel/HttpKernel.php(181): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#20 /var/www/html/website/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#21 /var/www/html/website/web/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle()
#22 /var/www/html/website/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#23 /var/www/html/website/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#24 /var/www/html/website/web/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle()
#25 /var/www/html/website/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(116): Drupal\big_pipe\StackMiddleware\ContentLength->handle()
#26 /var/www/html/website/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(90): Drupal\page_cache\StackMiddleware\PageCache->pass()
#27 /var/www/html/website/web/modules/contrib/advban/src/AdvbanMiddleware.php(57): Drupal\page_cache\StackMiddleware\PageCache->handle()
#28 /var/www/html/website/web/core/modules/ban/src/BanMiddleware.php(50): Drupal\advban\AdvbanMiddleware->handle()
#29 /var/www/html/website/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\ban\BanMiddleware->handle()
#30 /var/www/html/website/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#31 /var/www/html/website/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#32 /var/www/html/website/web/modules/contrib/remove_http_headers/src/StackMiddleware/RemoveHttpHeadersMiddleware.php(49): Drupal\Core\StackMiddleware\AjaxPageState->handle()
#33 /var/www/html/website/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\remove_http_headers\StackMiddleware\RemoveHttpHeadersMiddleware->handle()
#34 /var/www/html/website/web/core/lib/Drupal/Core/DrupalKernel.php(741): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
#35 /var/www/html/website/web/index.php(19): Drupal\Core\DrupalKernel->handle()
#36 {main}
Severity Debug

🐛 Bug report
Status

Active

Version

1.0

Component

AI Assistants API

Created by

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

Comments & Activities

  • Issue created by @jbuttler
  • 🇮🇳India annmarysruthy

    @jbuttler Icould not replicate the issue. I followed these steps while trying to replicate the issue:

    1. Configure the AI Assistant to use RAG access check
    2. Index content type 'article' (5 items)
    3. Login as a non-admin user
    4. Try interacting with chatbot

    Kindly let me know if there is any step I missed

  • @annmarysruthy you must index content for the issue to occur, but I would recommend looking at the details of the reported errors as the starting point to look for a solution.

Production build 0.71.5 2024