nautechsystems/nautilus_trader · error

Cannot stop actor, {actor_id} not found

Error message

Cannot stop actor, {actor_id} not found

What it means

stop_actor was called with an ActorId that is not in the trader's registered actor set; the actor was never added or has already been removed, so there is nothing to stop and the call fails fast.

Source

Thrown at crates/system/src/trader.rs:1301

    ///
    /// # Errors
    ///
    /// Returns an error if the actor is not registered or cannot be started.
    pub fn start_actor(&self, actor_id: &ActorId) -> anyhow::Result<()> {
        if !self.actor_ids.contains(actor_id) {
            anyhow::bail!("Cannot start actor, {actor_id} not found");
        }
        start_component(&actor_id.inner())
    }

    /// Stops the actor with the given `actor_id`.
    ///
    /// # Errors
    ///
    /// Returns an error if the actor is not registered or cannot be stopped.
    pub fn stop_actor(&self, actor_id: &ActorId) -> anyhow::Result<()> {
        if !self.actor_ids.contains(actor_id) {
            anyhow::bail!("Cannot stop actor, {actor_id} not found");
        }
        stop_component(&actor_id.inner())
    }

    /// Removes the actor with the given `actor_id`.
    ///
    /// Will stop the actor first if it is currently running. Disposes the actor
    /// and removes it from the trader's tracking.
    ///
    /// # Errors
    ///
    /// Returns an error if the actor is not registered, or if disposal fails. A failed disposal
    /// keeps the actor registered and tracked, and leaves it `Faulted`; see [`Component::dispose`].
    /// Calling this again retires the actor.
    pub fn remove_actor(&mut self, actor_id: &ActorId) -> anyhow::Result<()> {
        if !self.actor_ids.contains(actor_id) {
            anyhow::bail!("Cannot remove actor, {actor_id} not found");
        }

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Register the actor before attempting to stop it
  2. Verify the actor ID against the trader's registered actor IDs
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/system/src/trader.rs:1301 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/772403768a19a533. Report an issue: GitHub.