influxdata/influxdb · error · anyhow::Error

trigger not found

Error message

trigger not found: {key:?}

What it means

Raised by `plugin_for_key` when the database schema exists but `processing_engine_triggers.get_by_id` has no trigger matching the key's `trigger_id`. The key points at a trigger record that is missing from the catalog.

Solutions

  1. Confirm the trigger exists: `SHOW TRIGGERS` on the database; recreate it if it was dropped.
  2. Clear stale scheduled tasks (restart the node) so keys pointing at dropped triggers stop firing.
  3. In tests, resolve the trigger ID from the catalog instead of hardcoding it.
  4. Check for concurrent `DROP TRIGGER` / trigger execution races in your automation.

Example fix

// before
worker.load_plugin_for_test(TriggerKey { db_id, trigger_id: hard_coded_id })?;
// after
let trig = db.processing_engine_triggers.get_by_name("my_trigger").context("trigger missing")?;
worker.load_plugin_for_test(TriggerKey { db_id, trigger_id: trig.id })?;
Defensive patterns

Strategy: validation

Validate before calling

// Confirm the trigger exists before scheduling/executing
let trig = db_schema.processing_engine_triggers.get_by_id(&key.trigger_id)
    .ok_or_else(|| anyhow!("trigger {} gone; skipping run", key.trigger_id))?;

Try / catch

// Caller: treat as expected during DROP TRIGGER races
match worker.load_plugin_for_test(key) {
    Err(e) if e.to_string().contains("trigger not found") => {
        log::info!("trigger already dropped, skipping"); Ok(())
    }
    other => other.map(|_| ()),
}

Prevention

When it happens

Trigger: `execute_once` firing for a trigger key whose definition was dropped (e.g. `DROP TRIGGER`) between scheduling and execution, or `load_plugin_for_test` with a trigger ID that doesn't exist in the catalog.

Common situations: Race between trigger drop and queued trigger execution; stale in-memory queue entries after catalog updates; typo'd/renamed trigger referenced in tests or configuration.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


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

Appendix: source

Thrown at influxdb3_processing_engine/src/worker/local.rs:192

        let scheduler = schedulers.get(scheduler_node_id).and_then(Weak::upgrade);
        if scheduler.is_none() {
            schedulers.remove(scheduler_node_id);
        }
        scheduler
    }

    async fn plugin_for_key(
        &self,
        key: TriggerKey,
    ) -> Result<Arc<TriggerPlugin>, TriggerExecutionError> {
        let db_schema = self
            .catalog
            .db_schema_by_id(&key.db_id)
            .ok_or_else(|| anyhow!("database not found for trigger {key:?}"))?;
        let trigger_definition = db_schema
            .processing_engine_triggers
            .get_by_id(&key.trigger_id)
            .ok_or_else(|| anyhow!("trigger not found: {key:?}"))?;
        let db_name = db_schema.name.to_string();

        let load_generation = {
            let mut plugins = self.plugins.lock();
            let slot = plugins.entry(key).or_insert_with(|| self.new_plugin_slot());
            if let Some(plugin) = &slot.plugin
                && plugin.matches(&db_name, &trigger_definition)
            {
                return Ok(Arc::clone(plugin));
            }
            slot.generation
        };

        let plugin_code = Arc::new(
            read_plugin_code(
                &self.environment_manager,
                &trigger_definition.plugin_filename,
            )

View on GitHub (pinned to 06200ef96b)