nautechsystems/nautilus_trader · error

Runner already consumed - run() called twice

Error message

Runner already consumed - run() called twice

What it means

One-shot guard in LiveNode::run_with_mode: the node's runner has already been consumed by a previous run() call and cannot be taken again. The node struct is single-use per run, so a second run is rejected.

Source

Thrown at crates/live/src/node/mod.rs:1021

        self.run_with_mode(NodeRunMode::Owned).await
    }

    /// Run the live node under the given mode.
    ///
    /// [`NodeRunMode::Hosted`] leaves signal handling to the host application. Every other
    /// responsibility, including maintenance, reconciliation, external ingress, and the shutdown
    /// sequence, is identical across modes so that hosted and owned nodes cannot diverge.
    ///
    /// # Errors
    ///
    /// Returns an error if the node fails to start or encounters a runtime error.
    pub async fn run_with_mode(&mut self, mode: NodeRunMode) -> anyhow::Result<()> {
        if self.state().is_running() {
            anyhow::bail!("Already running");
        }

        if self.runner.is_none() {
            anyhow::bail!("Runner already consumed - run() called twice");
        }

        self.prepare_cache().await?;

        let Some(runner) = self.runner.take() else {
            anyhow::bail!("Runner already consumed - run() called twice");
        };
        runner.bind_senders();

        let AsyncRunnerChannels {
            mut time_evt_rx,
            mut system_evt_rx,
            mut system_cmd_rx,
            mut exec_evt_rx,
            mut exec_cmd_rx,
            mut data_evt_rx,
            mut data_cmd_rx,
        } = runner.take_channels();

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Call run() exactly once per node instance
  2. Create a new node instance for a fresh lifecycle
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/live/src/node/mod.rs:1021 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/3007cd0e25060fff. Report an issue: GitHub.