influxdata/influxdb · error · CatalogError

Cannot delete plugin

Error message

Cannot delete plugin {} in database {} because it is used by trigger {}

What it means

The plugin being deleted is still referenced by at least one Processing Engine trigger in the database. The catalog blocks the delete to prevent dangling triggers pointing at a missing plugin, reporting which trigger holds the reference.

Solutions

  1. Delete or re-point the dependent trigger (DROP TRIGGER on trigger_name) before deleting the plugin.
  2. Update the trigger to use a different plugin, then delete the old one.
  3. Use --force if you accept leaving the trigger without its plugin (recreate the trigger afterwards).

Example fix

// before
influxdb3 package delete my_plugin
// after
influxdb3 trigger delete my_trigger --database mydb
influxdb3 package delete my_plugin
Defensive patterns

Strategy: validation

Validate before calling

// Find and drop dependent triggers before deleting the plugin
const triggers = await client.listTriggers(db);
for (const t of triggers.filter(t => t.pluginName === pluginName)) {
  await client.deleteTrigger(db, t.triggerName);
}
await client.deletePlugin(db, pluginName);

Type guard

function hasDependentTriggers(triggers, pluginName) {
  return Array.isArray(triggers) && triggers.some(t => t?.pluginName === pluginName);
}

Try / catch

try {
  await deletePlugin(db, pluginName);
} catch (e) {
  const m = String(e).match(/used by trigger (\S+)/);
  if (m) {
    await deleteTrigger(db, m[1]);
    await deletePlugin(db, pluginName);
  } else throw e;
}

Prevention

When it happens

Trigger: Calling the plugin delete API for plugin_name while any trigger in database_name still has plugin_name set as its plugin, e.g. trigger trigger_name.

Common situations: Removing a plugin package that was wired into one or more triggers; cleaning up after renaming plugins when old triggers still reference the old name; scripted teardown that deletes plugins before triggers.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19). Data as JSON: /api/errors/8b2b9a1cc47296bb. Report an issue: GitHub.

Appendix: source

Thrown at influxdb3_catalog/src/error.rs:229

    Other(#[from] anyhow::Error),

    #[error(
        "Cannot overwrite Processing Engine Trigger {} in Database {}",
        trigger_name,
        database_name
    )]
    ProcessingEngineTriggerExists {
        database_name: String,
        trigger_name: String,
    },

    #[error(
        "Cannot delete running plugin {}. Disable it first or use --force.",
        trigger_name
    )]
    ProcessingEngineTriggerRunning { trigger_name: String },

    #[error(
        "Cannot delete plugin {} in database {} because it is used by trigger {}",
        plugin_name,
        database_name,
        trigger_name
    )]
    ProcessingEnginePluginInUse {
        database_name: String,
        plugin_name: String,
        trigger_name: String,
    },

    #[error(
        "Processing Engine Plugin {} not in DB schema for {}",
        plugin_name,
        database_name
    )]
    ProcessingEnginePluginNotFound {
        plugin_name: String,

View on GitHub (pinned to 06200ef96b)