nautechsystems/nautilus_trader · error

Failed while starting execution algorithm {exec_algorithm_id

Error message

Failed while starting execution algorithm {exec_algorithm_id}: {start_err:#}; failed to roll back restored subscriptions: {cleanup_err:#}

What it means

This error wraps a failure that occurred while starting an execution algorithm and additionally reports that the rollback of already-restored execution-algorithm subscriptions also failed. Both the original start error and the cleanup error are chained with `{:#}` formatting, so both root causes are visible.

Source

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

            }
        }

        if errors.is_empty() {
            Ok(())
        } else {
            anyhow::bail!("{}", errors.join("; "))
        }
    }

    fn exec_algorithm_start_error_with_rollback(
        &mut self,
        exec_algorithm_id: ExecAlgorithmId,
        restored_exec_algorithm_ids: &[ExecAlgorithmId],
        start_err: anyhow::Error,
    ) -> anyhow::Error {
        match self.cleanup_exec_algorithm_subscriptions_for(restored_exec_algorithm_ids) {
            Ok(()) => start_err,
            Err(cleanup_err) => anyhow::anyhow!(
                "Failed while starting execution algorithm {exec_algorithm_id}: {start_err:#}; \
                 failed to roll back restored subscriptions: {cleanup_err:#}"
            ),
        }
    }

    /// Stops all registered components.
    ///
    /// # Errors
    ///
    /// Returns an error if any component fails to stop.
    pub fn stop_components(&mut self) -> anyhow::Result<()> {
        for actor_id in &self.actor_ids {
            log::debug!("Stopping actor {actor_id}");
            Self::stop_component_if_active(actor_id.inner())?;
        }

        for exec_algorithm_id in &self.exec_algorithm_ids {

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Read both chained errors: fix the original start failure first (usually the root cause)
  2. Investigate why subscription cleanup failed (check message bus/client state and logs)
  3. Restart the trader/node for a clean state before retrying
  4. Add validation of exec algorithm config and registered clients before calling start
Defensive patterns

Strategy: try-catch

Try / catch

try:
    trader.start()
except Exception as e:
    logging.exception("start failed (check both start and rollback causes): %s", e)
    # inspect chained context for the root start error and cleanup error
    raise

Prevention

When it happens

Trigger: During `Trader.start_components`, an exec algorithm fails to start (its `start()` raises), and then `cleanup_exec_algorithm_subscriptions_for` also errors while unsubscribing/rolling back the subscriptions of the already-started exec algorithms.

Common situations: Exec algorithm start raising due to bad config or unregistered clients, combined with a poisoned/broken subscription state making rollback fail too; cache or message bus in an inconsistent state after a partial start.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


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