{"record":{"id":"e7f8e813b1ba7005","repo":"influxdata/influxdb","slug":"trigger-not-found-key","errorCode":null,"errorMessage":"trigger not found: {key:?}","messagePattern":"trigger not found: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"influxdb3_processing_engine/src/worker/local.rs","lineNumber":192,"sourceCode":"        let scheduler = schedulers.get(scheduler_node_id).and_then(Weak::upgrade);\n        if scheduler.is_none() {\n            schedulers.remove(scheduler_node_id);\n        }\n        scheduler\n    }\n\n    async fn plugin_for_key(\n        &self,\n        key: TriggerKey,\n    ) -> Result<Arc<TriggerPlugin>, TriggerExecutionError> {\n        let db_schema = self\n            .catalog\n            .db_schema_by_id(&key.db_id)\n            .ok_or_else(|| anyhow!(\"database not found for trigger {key:?}\"))?;\n        let trigger_definition = db_schema\n            .processing_engine_triggers\n            .get_by_id(&key.trigger_id)\n            .ok_or_else(|| anyhow!(\"trigger not found: {key:?}\"))?;\n        let db_name = db_schema.name.to_string();\n\n        let load_generation = {\n            let mut plugins = self.plugins.lock();\n            let slot = plugins.entry(key).or_insert_with(|| self.new_plugin_slot());\n            if let Some(plugin) = &slot.plugin\n                && plugin.matches(&db_name, &trigger_definition)\n            {\n                return Ok(Arc::clone(plugin));\n            }\n            slot.generation\n        };\n\n        let plugin_code = Arc::new(\n            read_plugin_code(\n                &self.environment_manager,\n                &trigger_definition.plugin_filename,\n            )","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_processing_engine/src/worker/local.rs#L174-L210","documentation":"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.","triggerScenarios":"`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.","commonSituations":"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.","solutions":["Confirm the trigger exists: `SHOW TRIGGERS` on the database; recreate it if it was dropped.","Clear stale scheduled tasks (restart the node) so keys pointing at dropped triggers stop firing.","In tests, resolve the trigger ID from the catalog instead of hardcoding it.","Check for concurrent `DROP TRIGGER` / trigger execution races in your automation."],"exampleFix":"// before\nworker.load_plugin_for_test(TriggerKey { db_id, trigger_id: hard_coded_id })?;\n// after\nlet trig = db.processing_engine_triggers.get_by_name(\"my_trigger\").context(\"trigger missing\")?;\nworker.load_plugin_for_test(TriggerKey { db_id, trigger_id: trig.id })?;","handlingStrategy":"validation","validationCode":"// Confirm the trigger exists before scheduling/executing\nlet trig = db_schema.processing_engine_triggers.get_by_id(&key.trigger_id)\n    .ok_or_else(|| anyhow!(\"trigger {} gone; skipping run\", key.trigger_id))?;","typeGuard":null,"tryCatchPattern":"// Caller: treat as expected during DROP TRIGGER races\nmatch worker.load_plugin_for_test(key) {\n    Err(e) if e.to_string().contains(\"trigger not found\") => {\n        log::info!(\"trigger already dropped, skipping\"); Ok(())\n    }\n    other => other.map(|_| ()),\n}","preventionTips":["Cancel scheduled executions when dropping a trigger","Re-read the catalog inside execution loops to detect drops early","Avoid renaming triggers that have active schedules without re-registration"],"tags":["catalog","triggers","resource-not-found","plugins"],"backgroundTag":"entity-not-found","analyzedSha":"06200ef96ba82c5f6727e5038a83af8e722c6875","analyzedAt":"2026-09-19T12:55:30.003Z","contentChangedAt":"2026-09-19T12:55:30.003Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}