Module Information
- Module Name: AI VDB Provider - Postgres (ai_vdb_provider_postgres)
- Module Version: 1.0.0-alpha2
- Drupal Core Version: 11.3
- AI Module Version: 1.2
Bug Description
The ai_vdb_provider_postgres module has an undeclared dependency on the
ai_search</
code> module. This causes a fatal error during Drupal's plugin discovery process, which prevents the "postgres
VDB provider plugin from being registered.</p>
<p>The error manifests as a <code>PluginNotFoundException, stating that the "postgres" plugin does
not exist. The list of available plugins for AiVdbProviderPluginManager is empty.
Root Cause Analysis
The plugin class Drupal\ai_vdb_provider_postgres\Plugin\VdbProvider\PostgresProvider.php h
a use statement for an interface from the ai_search module:
use Drupal\ai_search\EmbeddingStrategyInterface;However, the ai_vdb_provider_postgres.info.yml file does not list ai_search a
a dependency. If the ai_search module is not enabled, PHP cannot find the EmbeddingStrategyInterface, which causes a fatal error when the file is parsed. This silent failure
prevents the plugin from ever being discovered.
Steps to Reproduce
- Set up a Drupal site with the
aimodule installed and enabled. - Ensure the
ai_searchmodule is disabled. - Install and enable the
ai_vdb_provider_postgresmodule. - Clear all caches (e.g., run
drush cr). - Attempt to access any page or run any Drush command that involves the VDB provider plugins (e.g.,
visiting the module's configuration page). - Check the Drupal watchdog logs (Recent log messages). You will find an error like this:
Drupal\Component\Plugin\Exception\PluginNotFoundException: The "postgres" plugin does n exist. Valid plugin IDs for Drupal\ai\AiVdbProviderPluginManager are: in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition()
Resolution / Workaround
The issue is resolved by manually enabling the missing dependency:
- Enable the
ai_searchmodule (e.g., rundrush en ai_search -y). - Clear all caches (e.g., run
drush cr).
After these steps, the plugin is correctly discovered and the module's configuration page can be saved
without a 500 error.
Suggested Fix
The dependency should be explicitly declared. Please add ai_search:ai_search to the dependencies section of the ai_vdb_provider_postgres.info.yml file.
dependencies: - ai:ai - key:key - ai_search:ai_search
Issue fork ai_vdb_provider_postgres-3568148
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
joachim namysloComment #3
garvitasakhrani commentedI am working on it.
Comment #5
garvitasakhrani commentedFixed undeclared dependency by adding ai_search module.
Changes have been pushed to the issue fork branch 3568148-undeclared-dependency-on.
Please review. Thanks!
Comment #7
rosk0Added dependency to the
composer.jsonas well.RTBC from me.
Comment #8
asamoahboateng commentedworks well
Comment #9
rodrigoferreira19 commentedHi,
As it currently stands, drupal/ai_search version 2.0-alpha depends on drupal/ai version 2.0.x-dev. As a result, this combination may introduce instability or lead to unexpected errors in certain environments.
In the near future, as development progresses, a dedicated 2.0.x branch is expected to be established to formally support these newer versions. For the time being, however, the 1.0.x branch of this module is intended to remain compatible with the stable release of drupal/ai.
Comment #10
rodrigoferreira19 commentedComment #11
rodrigoferreira19 commentedComment #13
rodrigoferreira19 commented