Cannot create Search API based views On Drupal 11

Created on 20 June 2025, about 2 months ago

I’m encountering a major compatibility issue between the Search API module and the core Views module.

Environment:

  • Drupal 11.2.0 (clean installation using drush site:install)
  • Search API 8.x-1.38

Steps to reproduce:

  1. Create a test search server (using the database backend).
  2. Create a search index with just one field, it does not matter which field you add.
  3. Create a new view using the search index as the data source.

Issue:
In the view configuration, under both the page and block display settings, the "Format" dropdown includes three options:

  • (empty value) (machine name: search_api_data)
  • Fields
  • Rendered entity

Selecting the index triggers the following error messages, even if no page or block display is created:

The submitted value search_api_data in the "Output as" element is not allowed.
The submitted value search_api_data in the "Feed row style" element is not allowed.

Additionally, some warnings are logged immediately upon selecting the search index as the data source (see log output below).

Warning: Undefined array key "title" in Drupal\views\Views::fetchPluginNames() (line 157 of /var/www/html/web/core/modules/views/src/Views.php)

#0 /var/www/html/web/core/includes/bootstrap.inc(104): _drupal_error_handler_real()
#1 /var/www/html/web/core/modules/views/src/Views.php(157): _drupal_error_handler()
#2 /var/www/html/web/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php(233): Drupal\views\Views::fetchPluginNames()
#3 /var/www/html/web/core/modules/views_ui/src/ViewAddForm.php(150): Drupal\views\Plugin\views\wizard\WizardPluginBase->buildForm()
#4 /var/www/html/web/core/lib/Drupal/Core/Entity/EntityForm.php(107): Drupal\views_ui\ViewAddForm->form()
#5 /var/www/html/web/core/modules/views_ui/src/ViewFormBase.php(42): Drupal\Core\Entity\EntityForm->buildForm()
#6 [internal function]: Drupal\views_ui\ViewFormBase->buildForm()
#7 /var/www/html/web/core/lib/Drupal/Core/Form/FormBuilder.php(528): call_user_func_array()
#8 /var/www/html/web/core/lib/Drupal/Core/Form/FormBuilder.php(370): Drupal\Core\Form\FormBuilder->retrieveForm()
#9 /var/www/html/web/core/lib/Drupal/Core/Form/FormBuilder.php(625): Drupal\Core\Form\FormBuilder->rebuildForm()
#10 /var/www/html/web/core/lib/Drupal/Core/Form/FormBuilder.php(321): Drupal\Core\Form\FormBuilder->processForm()
#11 /var/www/html/web/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm()
#12 [internal function]: Drupal\Core\Controller\FormController->getContentResult()
#13 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
#14 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(622): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#15 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(121): Drupal\Core\Render\Renderer->executeInRenderContext()
#16 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
#17 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(183): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#18 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#19 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle()
#20 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#21 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#22 /var/www/html/web/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle()
#23 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(116): Drupal\big_pipe\StackMiddleware\ContentLength->handle()
#24 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(90): Drupal\page_cache\StackMiddleware\PageCache->pass()
#25 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle()
#26 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#27 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(53): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#28 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle()
#29 /var/www/html/web/core/lib/Drupal/Core/DrupalKernel.php(715): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
#30 /var/www/html/web/index.php(19): Drupal\Core\DrupalKernel->handle()
#31 {main}

Impact:
This issue effectively blocks the creation of any Views using a Search API index.

Notes:
The same setup works correctly on Drupal 10.4.8, so this appears to be a regression in Drupal 11 compatibility.

🐛 Bug report
Status

Active

Version

1.38

Component

General code

Created by

🇮🇹Italy finex

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

Merge Requests

Comments & Activities

  • Issue created by @finex
  • 🇧🇪Belgium bramvandenbulcke

    There is a Drupal core issue about issues with Views on non-English setups. I have troubles with all the Views at the moment.

    See https://www.drupal.org/project/drupal/issues/2987548 🐛 LogicException: The database connection is not serializable. Postponed: needs info .

  • 🇮🇹Italy finex

    I think it's a different bug because I've done a test using an english setup.

  • 🇷🇴Romania stefan.butura

    I am having the same issue on an English setup.

    Downgrading from Drupal 11.2.1 to 11.1.8 fixed the issue.

  • 🇳🇴Norway vegardjo

    Same issue, fresh installs, english only. Last one is a fresh install with only Gin and search_api as contributed modules. Also reported here 🐛 The submitted value [value] in the [name] element is not allowed. Active .

  • Merge request !247Check if plugins exist before setting a base → (Open) created by vegardjo
  • Pipeline finished with Success
    about 1 month ago
    Total: 359s
    #536881
  • 🇳🇴Norway vegardjo

    I took a stab at this, seems the search_api_data plugin is loaded later in 11.2 than before, so in search_api_views_plugins_row_alter() we now create it with too little info, rather than expanding on it. The plugin is only used for data exports, like a rest export view display, and is not available before you create a display like that.

    • Tested only on 11.2.2 for now
    • Tested that the plugin is available for a REST export display, after enabling core rest module
  • 🇧🇷Brazil hfernandes

    I was having this issue and the patch fixed it here.
    Drupal 11.2.2
    Search API 8.x-1.38

  • 🇹🇭Thailand peterbkk

    I'm having this issue also on Drupal 11.2.2 Search API 8.x-1.38, any solutions? @hfernandes which patch did you use?

  • 🇸🇮Slovenia deaom

    Having the same issue on D11.2.2, where a search api view can't be created, because of the "Format" dropdown which includes three options, as mentioned in the issue summary. Once the patch is applied, the empty value is no longer present for selection and Fields or Rendered entity can be selected and view created.

  • 🇧🇷Brazil hfernandes

    I spent some time reviewing this issue and trying to identify the root cause - and I believe I’ve finally found it.

    The search_api_data plugin extends DataEntityRow, which belongs to the rest module.
    On websites where the rest module is not enabled, the plugin discovery fails to locate the DataEntityRow definition, causing the search_api_data plugin to break.

    Here are a few possible solutions that could be implemented in the search_api module:

    1. If search_api_data relies on the rest module, then search_api should declare rest as a dependency and enable this module.
    2. Create a new search_api_rest submodule that depends on the rest and contains the search_api_data plugin.
    3. Refactor the search_api_data plugin to extend RowPluginBase instead of DataEntityRow.

    Among the three, I believe the third option is preferable, as it would have the least impact on websites currently using the search_api_data plugin.

  • 🇳🇴Norway vegardjo

    I'm not sure this needs more work, even though it could likely be solved differently.

    The plugin is not directly tied to Rest module. If you create a view display of stream / feed / RSS (can't remember the name now), you will also use the plugin, but without Rest module.

    I believe the change that happened in 11.2 is when these plugins are discovered, and that there are some optimalisations in place to lazy load / load on demand plugins, that was not there before 11.2.

    If you do a dump of the plugin in d10 you will see that it exists already at /admin/structure/views (screenshot), but if you do the same in d11 you will see that it is null. The alter code is adding a ['base'] to the defined plugin, which is fine, but when the plugin is not defined it will rather create a broken plugin definition, with only the ['base'] info, which is what breaks the UI.

    The MR simply checks if it exist before it alters it, so it should be very safe. It could be tested further if there are any problems creating displays that uses search_api_data in 11.2, like the bases are not added, but in my limited testing everything seemed fine.

    Setting back status, but please just change it again if there is something I have not grasped completely here :)

  • 🇧🇷Brazil hfernandes

    @vegardjo I'm not opposed to the current fix, as it makes sense to check if the plugin exists before accessing its attributes. However, this solution doesn't address the root cause of the issue. The problem lies in the search_api_data plugin failing to be instantiated - not due to lazy loading, but due to an architectural oversight.

    This plugin extends Drupal\rest\Plugin\views\row\DataEntityRow which is defined in the rest module. Relying on a module without declaring it as a dependency is problematic. In fact, simply enabling the rest module resolves the issue without applying the patch.

    In Drupal 11.2, this may have been addressed through improved plugin discovery that respects enabled modules.

    From what I’ve gathered, the Entity (Search API) plugin is intended for use specifically with REST export displays. If that’s confirmed to be the case, then one of the earlier options I suggested - either declaring a dependency or moving the plugin to a dedicated submodule - might be a more appropriate and sustainable fix.

  • 🇳🇴Norway vegardjo

    Thanks for the thorough explanation, @hfernandes, I see now that I was indeed wrong in my assessment that the class / plugin is not directly tied to the Rest module.

    Given that I agree that your options 2 or 3 seems best way forward. I assume most SAPI use cases does not involve Rest exports, so having Rest as a dependency on SAPI itself seems overkill.

    Untill this is done the solution to the original problem is then either:

    • Apply the MR as it is now, as it will atleast allow you to create normal SAPI views again
    • Enable Rest module
  • 🇮🇹Italy finex

    I agree with the @hfernandes solution. The easiest solution would be to simply set the rest module as required.

  • Pipeline finished with Canceled
    about 1 month ago
    Total: 217s
    #547269
  • Pipeline finished with Failed
    about 1 month ago
    Total: 352s
    #547275
  • Pipeline finished with Failed
    about 1 month ago
    Total: 396s
    #547302
  • Pipeline finished with Failed
    about 1 month ago
    Total: 364s
    #547311
  • 🇧🇷Brazil hfernandes

    I've decided to move this implementation to a submodule, as enabling the rest module may not be appropriate for all websites.

    The tests are still failing because we need to migrate the PHPUnit test that validates the views_rest test case to the new submodule.

  • 🇮🇹Italy finex

    Good idea @hfernandes, thank you! If I managed to find some time today, I would like to try the MR

  • Pipeline finished with Canceled
    about 1 month ago
    Total: 129s
    #548322
  • Pipeline finished with Failed
    about 1 month ago
    Total: 362s
    #548323
  • 🇧🇷Brazil hfernandes

    I've fixed the unit tests.
    However, there is one unit test still failing that I don't think is related to this change - Drupal\Tests\search_api_db_defaults\Functional\IntegrationTest - perhaps related to 🐛 Replace deprecated REQUIREMENT_ERROR constant in search_api_db_defaults_requirements() for Drupal 11+ compatibility Active

    I'm moving this to Needs review.

  • 🇺🇸United States averagejoe3000 Swanzey, NH

    I ran into this exact issue using Drupal 11.2.2. I applied the patch from merge request 247 and can confirm that fixed the issue for me.

  • 🇺🇸United States j-phat

    can confirm patching working on 11.2.2.

    thank you @hfernandes

  • 🇮🇹Italy finex

    Seems okay to me too, thanks.

  • 🇧🇷Brazil andre.bonon

    Works for me after applying the patch.

  • 🇬🇧United Kingdom scott_euser

    Thank you for sorting this one out! This also fixes the AI Search module (sub-module of AI core) where tests had to be disabled temporarily as a result: 📌 Reinstate MySQL tests Active

  • 🇮🇳India gauravjeet

    Can confirm the patch from MR 247 works!

    Following is my version stack:
    Search API Solr - 4.3.10
    Search API - 8.x-1.38
    Drupal - 11.2.2

    Thanks for the MR, we can have a search_api version bump!

  • 🇮🇷Iran khaleghian

    khaleghian changed the visibility of the branch 3531256-cannot-create-search to hidden.

  • 🇮🇷Iran khaleghian

    khaleghian changed the visibility of the branch 3531256-cannot-create-search to active.

  • 🇳🇱Netherlands ifrik

    The patch from MR247 also works from me on core 11.2.2

  • 🇦🇹Austria drunken monkey Vienna, Austria

    Thanks a lot for reporting this problem and already providing fixes!
    However, I’m not sure I fully understand why the new module is needed? It seemed vegardjo’s initial fix was already working fine.

    Are there any actual problems when just applying the small fix to search_api_views_plugins_row_alter() and the REST module is not installed? Could I have steps to reproduce for those?

  • 🇧🇷Brazil hfernandes

    Hi @drunken monkey,

    Please take a look at comments #12 and #14 for an explanation of why this submodule is needed.
    Let me know if it makes sense or if you'd like me to provide more details.

  • Pipeline finished with Success
    11 days ago
    Total: 398s
    #564909
  • 🇬🇧United Kingdom scott_euser

    Rereading the comments and checking the code change, moving to submodule does seem to be the right way to fix it rather than just masking the problem like initial commit. If we extend a core module we should make sure it is enabled. The approach of auto-enabling the sub-module when in use is a pattern we used before when splitting out providers from the AI Core module.

    That said it could be split into a seperate follow-up issue if it means getting it fixed sooner with just the initial commit workaround. At least for me this is slowing progress on AI Search since it's harder to keep up with issue queue there with tests failing and both options would unblock that.

  • 🇬🇧United Kingdom scott_euser

    Ah and tests now pass after updating fork now that 🐛 Fix failing pipelines Active is resolved (thank you!)

  • 🇦🇹Austria drunken monkey Vienna, Austria

    @hfernandes: I did read those comments, but they don’t answer my question: Are there any actual problems for users? You just state that “this is problematic” without explaining why.
    This module provides a bunch of classes integrating with specific modules we do not depend upon. I do not want to create a new submodule for each of them, and haven’t so far. (To be fair, not sure if any of the others actually extend a class that would be unavailable.) In the case of the taxonomy-related Views plugins, there were actual problems so we had to work around them, see search_api_views_plugins_argument_alter() and search_api_views_plugins_filter_alter(). Maybe we could do something like this for the REST data row style, too, if necessary. However, it currently seems like we really need to just add that single check (which does make immediate and perfect sense, of course) and we’re fine, so I am loathe to add an entire new submodule just on the basis of “this is problematic”.

    @scott_euser: Yes, if you want to get this resolved quickly then a new MR with just this one change seems like the better option.
    I’ve created a new MR with just your initial commit. Please ping me on Slack if you’re happy with that (it seems people were happy with it originally, too, so no further tests/reviews should be necessary) and I’ll merge it right away.
    We can then leave this issue open to complete the discussion regarding a submodule or other additional measures.

  • 🇬🇧United Kingdom scott_euser

    Yep perfectly happy with the new MR "3531256-views-row-alter-checks" you created with just the initial commit from @vegardjo and your explanation for not wanting an extra sub-module fair enough - perhaps if the use statement somehow causes a fatal error not existing for some scenario we haven't come across then a follow-up can be raised with lower priority. Thank you!!

  • 🇸🇳Senegal ostry.sn

    I tried to generate a patch from the MR

  • Pipeline finished with Skipped
    6 days ago
    #568755
  • 🇦🇹Austria drunken monkey Vienna, Austria

    @scott_euser: Thanks for the feedback, good to hear! And yes, sorry, it was @vegardjo who made that first fix, not you. Thanks for pointing it out.
    Merged my new MR.
    If someone still wants to argue for the sub-module, please open a new issue with additional information as explained.

  • 🇺🇸United States Solomon.Yifru

    Great solution, it worked for me as well! thanks @drunken monkey

Production build 0.71.5 2024