nautechsystems/nautilus_trader · error

Invalid LiveNode control state {control:#04x} while entering

Error message

Invalid LiveNode control state {control:#04x} while entering Running

What it means

finish_startup_replay asks the node to transition its lifecycle control state into Running; RunningTransition::Invalid(control) means the LiveNode's internal control state machine was in a state from which entering Running is not a valid transition. The node aborts startup with this error carrying the raw control bitmask. This signals an internal lifecycle bug or corrupted state rather than a user configuration problem.

Source

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

        } else if self.kernel.is_shutdown_requested() {
            Some("Shutdown signal received during startup")
        } else {
            None
        }
    }

    async fn finish_startup_replay(&mut self) -> anyhow::Result<bool> {
        match self.handle.try_set_running() {
            RunningTransition::Entered => Ok(true),
            RunningTransition::StopRequested => {
                self.abort_startup("Stop signal received during startup")
                    .await?;
                Ok(false)
            }
            RunningTransition::Invalid(control) => {
                self.abort_startup_with_error(
                    "Invalid lifecycle state during startup",
                    anyhow::anyhow!(
                        "Invalid LiveNode control state {control:#04x} while entering Running"
                    ),
                )
                .await?;
                Ok(false)
            }
        }
    }

    async fn finish_startup_trader(
        &mut self,
        receivers: Option<&mut RunnerReceivers<'_>>,
    ) -> anyhow::Result<bool> {
        match self.handle.try_set_running() {
            RunningTransition::Entered => Ok(true),
            RunningTransition::StopRequested => {
                self.abort_started_trader("Stop signal received during startup", receivers)
                    .await?;

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Restart the node cleanly; transient signal races typically resolve on a fresh startup.
  2. Ensure nothing sends stop/shutdown signals to the node concurrently with startup.
  3. Capture the reported control value and file a bug — an invalid transition from normal startup flow indicates a lifecycle invariant violation.
  4. Verify no custom runner/embedding code manipulates node control state directly.
Defensive patterns

Strategy: try-catch

Validate before calling

// Do not send control signals concurrently with startup
assert!(!shutdown_requested.load(Ordering::SeqCst), "stop signalled before/during start()");

Try / catch

match node.start().await {
    Err(e) if e.to_string().contains("Invalid LiveNode control state") => {
        // capture control bitmask from message, restart cleanly, report upstream
    }
    other => other?,
}

Prevention

When it happens

Trigger: During start()/run_with_mode on the event-store replay path, finish_startup_replay receives RunningTransition::Invalid(control) from the state transition (mod.rs:2142-2150).

Common situations: A stop/shutdown signal raced with startup so the state moved past the valid Running entry point; concurrent control calls; a bug in lifecycle management leaving the control state in an unexpected bitmask.

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/0476e538287d7da3. Report an issue: GitHub.