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

  1. Set up a Drupal site with the ai module installed and enabled.
  2. Ensure the ai_search module is disabled.
  3. Install and enable the ai_vdb_provider_postgres module.
  4. Clear all caches (e.g., run drush cr).
  5. Attempt to access any page or run any Drush command that involves the VDB provider plugins (e.g.,
    visiting the module's configuration page).
  6. 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:

  1. Enable the ai_search module (e.g., run drush en ai_search -y).
  2. 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
        
Command icon 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

joachim namyslo created an issue. See original summary.

joachim namyslo’s picture

Title: Bug Report: Undeclared Dependency on `ai_search` Module< » Undeclared Dependency on `ai_search` Module
garvitasakhrani’s picture

Assigned: Unassigned » garvitasakhrani

I am working on it.

garvitasakhrani’s picture

Assigned: garvitasakhrani » Unassigned
Status: Active » Needs review

Fixed undeclared dependency by adding ai_search module.
Changes have been pushed to the issue fork branch 3568148-undeclared-dependency-on.
Please review. Thanks!

rosk0 made their first commit to this issue’s fork.

rosk0’s picture

Added dependency to the composer.json as well.

RTBC from me.

asamoahboateng’s picture

works well

rodrigoferreira19’s picture

Hi,

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.

rodrigoferreira19’s picture

Status: Needs review » Needs work
rodrigoferreira19’s picture

Status: Needs work » Needs review

rodrigoferreira19’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.