Hmbown/CodeWhale · error · anyhow::Error

Trigger ' ' not found

Error message

Trigger '{trigger_id}' not found

What it means

get_trigger_for_owner deliberately collapses every failure — absent record, foreign owner, ownerless legacy record, unreadable file — into this single 'not found' result so trigger existence cannot be disclosed across sessions; callers cannot distinguish the causes by design.

Solutions

  1. Use get_trigger with the correct trigger id (from create_trigger's return or list_triggers).
  2. Check for typos; the file for that id does not exist under the triggers directory.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/tui/src/automation_manager.rs:1919 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/02c7620e88209d5f. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/automation_manager.rs:1919

                CURRENT_TRIGGER_SCHEMA_VERSION
            );
        }
        Ok(record)
    }

    /// Load a trigger only when it belongs to the given session.
    ///
    /// Foreign, ownerless legacy, unreadable, and absent records share the same
    /// result so trigger existence cannot be disclosed across sessions.
    pub fn get_trigger_for_owner(
        &self,
        trigger_id: &str,
        owner_session_id: &str,
    ) -> Result<DelayedTriggerRecord> {
        self.get_trigger(trigger_id)
            .ok()
            .filter(|record| record.owner_session_id.as_deref() == Some(owner_session_id))
            .ok_or_else(|| anyhow::anyhow!("Trigger '{trigger_id}' not found"))
    }

    /// Atomically persist a trigger record.
    pub fn save_trigger(&self, record: &DelayedTriggerRecord) -> Result<()> {
        self.with_transaction(|| self.save_trigger_unlocked(record))
    }

    fn save_trigger_unlocked(&self, record: &DelayedTriggerRecord) -> Result<()> {
        let path = self.trigger_path(&record.trigger_id)?;
        write_json_atomic(&path, record)
    }

    /// List triggers, newest first.  Pass `status_filter` to restrict results.
    pub fn list_triggers(
        &self,
        status_filter: Option<DelayedTriggerStatus>,
        limit: Option<usize>,
    ) -> Result<Vec<DelayedTriggerRecord>> {

View on GitHub (pinned to 73e0f67d83)