- Issue created by @solideogloria
Do you see Search API when running
drush pm-list --no-core --type=Module
? Are there any more errors in watchdogdrush watchdog:show
andthen drush watchdog:show-one <id>
Yes, I see it.
> drush pm-list --no-core --type=Module ... Search Database Search (search_api_db) Disabled 8.x-1.30 Search Database Search Defaults (search_api_db_defaults) Disabled 8.x-1.30 Search Search API (search_api) Disabled 8.x-1.30
I have no errors at all, until I run either the install or uninstall command once. After running either one, most Drush commands will fail from there afterward.
$ drush en search_api -vvv [preflight] Config paths: /var/www/html/vendor/drush/drush/drush.yml,/var/www/html/drush/drush.yml [preflight] Alias paths: /var/www/html/web/drush/sites,/var/www/html/drush/sites [preflight] Commandfile search paths: /var/www/html/vendor/drush/drush/src,/var/www/html/drush [debug] Bootstrap further to find pm:install [0.96 sec, 2.69 MB] [debug] Trying to bootstrap as far as we can [0.96 sec, 2.69 MB] [info] Drush bootstrap phase: bootstrapDrupalRoot() [0.96 sec, 2.7 MB] [info] Change working directory to /var/www/html/web [0.96 sec, 2.7 MB] [info] Initialized Drupal 10.1.5 root directory at /var/www/html/web [0.96 sec, 2.7 MB] [info] Drush bootstrap phase: bootstrapDrupalSite() [0.96 sec, 2.77 MB] [debug] Could not find a Drush config file at sites/default/drush.yml. [0.96 sec, 2.83 MB] [info] Initialized Drupal site docs9.ddev.site at sites/default [0.96 sec, 2.83 MB] [info] Drush bootstrap phase: bootstrapDrupalConfiguration() [0.96 sec, 2.83 MB] [info] Drush bootstrap phase: bootstrapDrupalDatabase() [0.97 sec, 3.03 MB] [info] Successfully connected to the Drupal database. [0.98 sec, 3.02 MB] [info] Drush bootstrap phase: bootstrapDrupalFull() [0.98 sec, 3.03 MB] [debug] Start bootstrap of the Drupal Kernel. [0.98 sec, 3.02 MB] [debug] Finished bootstrap of the Drupal Kernel. [1 sec, 3.93 MB] [debug] Loading drupal module drush commands & etc. [1 sec, 3.93 MB] [debug] Found drush.services.yml for key Drush commands [1.01 sec, 4.01 MB] [debug] Found drush.services.yml for migrate_tools Drush commands [1.01 sec, 4.01 MB] [debug] Add a commandfile class: Drush\Drupal\Commands\sql\SanitizeCommands [1.05 sec, 5.61 MB] [debug] Add a commandfile class: Drush\Drupal\Commands\sql\SanitizeCommentsCommands [1.05 sec, 5.61 MB] [debug] Add a commandfile class: Drush\Drupal\Commands\sql\SanitizeSessionsCommands [1.05 sec, 5.62 MB] [debug] Add a commandfile class: Drush\Drupal\Commands\sql\SanitizeUserFieldsCommands [1.05 sec, 5.62 MB] [debug] Add a commandfile class: Drush\Drupal\Commands\sql\SanitizeUserTableCommands [1.05 sec, 5.62 MB] [debug] Add a commandfile class: Drupal\key\Commands\KeyCommands [1.05 sec, 5.62 MB] [debug] Add a commandfile class: Drupal\migrate_tools\Drush\MigrateToolsCommands [1.05 sec, 5.64 MB] [debug] Add a commandfile class: Drupal\migrate_upgrade\Commands\MigrateUpgradeCommands [1.06 sec, 5.68 MB] [debug] Add a commandfile class: Drupal\vite\Commands\ViteCommands [1.06 sec, 5.69 MB] [debug] Done with bootstrap max in Application::bootstrapAndFind(): trying to find pm:install again. [1.15 sec, 7.42 MB] [info] Starting bootstrap to none [1.16 sec, 7.44 MB] [info] Drush bootstrap phase 0 [1.16 sec, 7.44 MB] [info] Try to validate bootstrap phase 0 [1.16 sec, 7.44 MB] [debug] Get container builder [1.29 sec, 10.23 MB] In Schema.php line 613: [Drupal\Core\Database\SchemaObjectExistsException] Table 'search_api_item' already exists. Exception trace: at /var/www/html/web/core/lib/Drupal/Core/Database/Schema.php:613 Drupal\Core\Database\Schema->createTable() at /var/www/html/web/core/lib/Drupal/Core/Extension/ModuleInstaller.php:648 Drupal\Core\Extension\ModuleInstaller->installSchema() at /var/www/html/web/core/lib/Drupal/Core/Extension/ModuleInstaller.php:267 Drupal\Core\Extension\ModuleInstaller->install() at /var/www/html/web/core/lib/Drupal/Core/ProxyClass/Extension/ModuleInstaller.php:83 Drupal\Core\ProxyClass\Extension\ModuleInstaller->install() at /var/www/html/vendor/drush/drush/src/Commands/pm/PmCommands.php:102 Drush\Commands\pm\PmCommands->install() at n/a:n/a call_user_func_array() at /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php:276 Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback() at /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php:212 Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter() at /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php:175 Consolidation\AnnotatedCommand\CommandProcessor->process() at /var/www/html/vendor/consolidation/annotated-command/src/AnnotatedCommand.php:387 Consolidation\AnnotatedCommand\AnnotatedCommand->execute() at /var/www/html/vendor/symfony/console/Command/Command.php:326 Symfony\Component\Console\Command\Command->run() at /var/www/html/vendor/symfony/console/Application.php:1081 Symfony\Component\Console\Application->doRunCommand() at /var/www/html/vendor/symfony/console/Application.php:320 Symfony\Component\Console\Application->doRun() at /var/www/html/vendor/symfony/console/Application.php:174 Symfony\Component\Console\Application->run() at /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php:110 Drush\Runtime\Runtime->doRun() at /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php:40 Drush\Runtime\Runtime->run() at /var/www/html/vendor/drush/drush/drush.php:139 require() at /var/www/html/vendor/drush/drush/drush:4 include() at /var/www/html/vendor/bin/drush:119 $ drush status -vvv [preflight] Config paths: /var/www/html/vendor/drush/drush/drush.yml,/var/www/html/drush/drush.yml [preflight] Alias paths: /var/www/html/web/drush/sites,/var/www/html/drush/sites [preflight] Commandfile search paths: /var/www/html/vendor/drush/drush/src,/var/www/html/drush [info] Starting bootstrap to max [0.4 sec, 2.7 MB] [debug] Trying to bootstrap as far as we can [0.4 sec, 2.7 MB] [info] Drush bootstrap phase: bootstrapDrupalRoot() [0.4 sec, 2.7 MB] [info] Change working directory to /var/www/html/web [0.4 sec, 2.7 MB] [info] Initialized Drupal 10.1.5 root directory at /var/www/html/web [0.4 sec, 2.7 MB] [info] Drush bootstrap phase: bootstrapDrupalSite() [0.41 sec, 2.84 MB] [debug] Could not find a Drush config file at sites/default/drush.yml. [0.41 sec, 2.84 MB] [info] Initialized Drupal site docs9.ddev.site at sites/default [0.41 sec, 2.84 MB] [info] Drush bootstrap phase: bootstrapDrupalConfiguration() [0.41 sec, 2.84 MB] [info] Drush bootstrap phase: bootstrapDrupalDatabase() [0.42 sec, 3.1 MB] [info] Successfully connected to the Drupal database. [0.42 sec, 3.1 MB] [info] Drush bootstrap phase: bootstrapDrupalFull() [0.42 sec, 3.1 MB] [debug] Start bootstrap of the Drupal Kernel. [0.42 sec, 3.1 MB] [debug] Finished bootstrap of the Drupal Kernel. [0.44 sec, 4.03 MB] [debug] Loading drupal module drush commands & etc. [0.44 sec, 4.03 MB] [debug] Found drush.services.yml for key Drush commands [0.45 sec, 4.04 MB] [debug] Found drush.services.yml for migrate_tools Drush commands [0.45 sec, 4.04 MB] In EntityTypeManager.php line 139: [Drupal\Component\Plugin\Exception\PluginNotFoundException] The "search_api_index" entity type does not exist. Exception trace: at /var/www/html/web/core/lib/Drupal/Core/Entity/EntityTypeManager.php:139 Drupal\Core\Entity\EntityTypeManager->getDefinition() at /var/www/html/web/core/lib/Drupal/Core/Entity/EntityTypeManager.php:253 Drupal\Core\Entity\EntityTypeManager->getHandler() at /var/www/html/web/core/lib/Drupal/Core/Entity/EntityTypeManager.php:192 Drupal\Core\Entity\EntityTypeManager->getStorage() at /var/www/html/web/modules/contrib/search_api/src/Utility/CommandHelper.php:93 Drupal\search_api\Utility\CommandHelper->__construct() at /var/www/html/web/modules/contrib/search_api/src/Commands/SearchApiCommands.php:46 Drupal\search_api\Commands\SearchApiCommands->__construct() at n/a:n/a ReflectionClass->newInstanceArgs() at /var/www/html/vendor/drush/drush/src/Runtime/LegacyServiceInstantiator.php:193 Drush\Runtime\LegacyServiceInstantiator->instantiateObject() at /var/www/html/vendor/drush/drush/src/Runtime/LegacyServiceInstantiator.php:174 Drush\Runtime\LegacyServiceInstantiator->create() at /var/www/html/vendor/drush/drush/src/Runtime/LegacyServiceInstantiator.php:128 Drush\Runtime\LegacyServiceInstantiator->instantiateServices() at /var/www/html/vendor/drush/drush/src/Runtime/LegacyServiceInstantiator.php:60 Drush\Runtime\LegacyServiceInstantiator->loadServiceFiles() at /var/www/html/vendor/drush/drush/src/Boot/DrupalBoot8.php:257 Drush\Boot\DrupalBoot8->addDrupalModuleDrushCommands() at /var/www/html/vendor/drush/drush/src/Boot/DrupalBoot8.php:233 Drush\Boot\DrupalBoot8->bootstrapDrupalFull() at /var/www/html/vendor/drush/drush/src/Boot/BootstrapManager.php:236 Drush\Boot\BootstrapManager->doBootstrap() at /var/www/html/vendor/drush/drush/src/Boot/BootstrapManager.php:422 Drush\Boot\BootstrapManager->bootstrapMax() at /var/www/html/vendor/drush/drush/src/Boot/BootstrapManager.php:357 Drush\Boot\BootstrapManager->bootstrapToPhaseIndex() at /var/www/html/vendor/drush/drush/src/Boot/BootstrapManager.php:329 Drush\Boot\BootstrapManager->bootstrapToPhase() at /var/www/html/vendor/drush/drush/src/Boot/BootstrapHook.php:36 Drush\Boot\BootstrapHook->initialize() at /var/www/html/vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php:44 Consolidation\AnnotatedCommand\Hooks\Dispatchers\InitializeHookDispatcher->doInitializeHook() at /var/www/html/vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php:36 Consolidation\AnnotatedCommand\Hooks\Dispatchers\InitializeHookDispatcher->callInitializeHook() at /var/www/html/vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php:29 Consolidation\AnnotatedCommand\Hooks\Dispatchers\InitializeHookDispatcher->initialize() at /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php:145 Consolidation\AnnotatedCommand\CommandProcessor->initializeHook() at /var/www/html/vendor/consolidation/annotated-command/src/AnnotatedCommand.php:376 Consolidation\AnnotatedCommand\AnnotatedCommand->initialize() at /var/www/html/vendor/symfony/console/Command/Command.php:292 Symfony\Component\Console\Command\Command->run() at /var/www/html/vendor/symfony/console/Application.php:1081 Symfony\Component\Console\Application->doRunCommand() at /var/www/html/vendor/symfony/console/Application.php:320 Symfony\Component\Console\Application->doRun() at /var/www/html/vendor/symfony/console/Application.php:174 Symfony\Component\Console\Application->run() at /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php:110 Drush\Runtime\Runtime->doRun() at /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php:40 Drush\Runtime\Runtime->run() at /var/www/html/vendor/drush/drush/drush.php:139 require() at /var/www/html/vendor/drush/drush/drush:4 include() at /var/www/html/vendor/bin/drush:119
Once in that error state, viewing any page will show just a white screen with this error:
Drupal\Core\Entity\Exception\NoCorrespondingEntityClassException: The Drupal\search_api\Entity\Index class does not correspond to an entity type. in Drupal\Core\Entity\EntityTypeRepository->getEntityTypeFromClass() (line 114 of core/lib/Drupal/Core/Entity/EntityTypeRepository.php). Drupal\Core\Entity\EntityBase::loadMultiple() (Line: 43) search_api_views_data() (Line: 236) Drupal\views\ViewsData->Drupal\views\{closure}(Object, 'search_api') (Line: 388) Drupal\Core\Extension\ModuleHandler->invokeAllWith('views_data', Object) (Line: 235) Drupal\views\ViewsData->getData() (Line: 154) Drupal\views\ViewsData->get('file_managed') (Line: 94) Drupal\views\Plugin\Derivative\ViewsEntityRow->getDerivativeDefinitions(Array) (Line: 101) Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDerivatives(Array) (Line: 87) Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDefinitions() (Line: 291) Drupal\Core\Plugin\DefaultPluginManager->findDefinitions() (Line: 181) Drupal\Core\Plugin\DefaultPluginManager->getDefinitions() (Line: 146) views_theme(Array, 'module', 'views', 'core/modules/views') (Line: 455) Drupal\Core\Theme\Registry->processExtension(Array, 'views', 'module', 'views', 'core/modules/views') (Line: 348) Drupal\Core\Theme\Registry->Drupal\Core\Theme\{closure}(Object, 'views') (Line: 388) Drupal\Core\Extension\ModuleHandler->invokeAllWith('theme', Object) (Line: 347) Drupal\Core\Theme\Registry->build() (Line: 247) Drupal\Core\Theme\Registry->get() (Line: 88) Drupal\Core\Utility\ThemeRegistry->initializeRegistry() (Line: 69)
- Status changed to Postponed: needs info
about 1 year ago 2:08pm 29 October 2023 - 🇦🇹Austria drunken monkey Vienna, Austria
What if (from a working installation) you drop the tables and clear the cache before trying
drush en search_api -vvv
?
In any case, it seems like a pretty tricky problem and I don’t really know what to do here, either. I guess you can just try things until you hit at something that works. To me, this looks like an old core problem ✨ When trying to create a table that already exists but is empty, recreate the table rather than throwing a DatabaseSchemaObjectExistsException Needs work . Since you potentially installed the module long ago, there might be a schema associated with the search API, that is causing this problem. You could try to further debug this by using Devel module → . Hopefully, with these tools, you might be able to find the root of the problem.
- Status changed to Fixed
about 1 year ago 10:17pm 30 October 2023 This worked. Afterwards, I can install and uninstall the module. What I did to get here was I exported the database to a SQL file, opened that in my IDE, and went line by line to see what tables in the DB had references to "search_api" using Ctrl+F.
DROP TABLE search_api_db_content; DROP TABLE search_api_db_content_changed; DROP TABLE search_api_db_content_created; DROP TABLE search_api_db_content_node_grants; DROP TABLE search_api_db_content_promote; DROP TABLE search_api_db_content_uid; DROP TABLE search_api_db_content_search_api_datasource; DROP TABLE search_api_db_content_search_api_language; DROP TABLE search_api_db_content_status; DROP TABLE search_api_db_content_sticky; DROP TABLE search_api_db_content_text; DROP TABLE search_api_db_content_type; DROP TABLE search_api_item; DROP TABLE search_api_task; TRUNCATE cache_bootstrap; TRUNCATE cache_config; TRUNCATE cache_container; TRUNCATE cache_data; TRUNCATE cache_default; TRUNCATE cache_discovery; TRUNCATE cache_discovery_migration; TRUNCATE cache_dynamic_page_cache; TRUNCATE cache_entity; TRUNCATE cache_menu; TRUNCATE cache_migrate; TRUNCATE cache_page; TRUNCATE cache_render; TRUNCATE cache_toolbar; DELETE FROM cachetags WHERE tag LIKE 'config:search_api%'; DELETE FROM key_value WHERE (collection = 'system.schema' AND `name` LIKE 'search_api%') OR collection IN ('config.entity.key_store.search_api_index', 'config.entity.key_store.search_api_server', 'search_api_db.indexes') OR collection LIKE 'search_api%' OR `name` LIKE '%search_api%' ;
Automatically closed - issue fixed for 2 weeks with no activity.