{"record":{"id":"11e14a77bacd62e5","repo":"nautechsystems/nautilus_trader","slug":"live-runner-system-command-channel-is-unavailable","errorCode":null,"errorMessage":"Live runner system command channel is unavailable","messagePattern":"Live runner system command channel is unavailable","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/common/src/actor/data_actor.rs","lineNumber":5760,"sourceCode":"    /// Sends a fire-and-observe reconnect command.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if the actor is not registered, the endpoint label is invalid, the live\n    /// runner is unavailable, or the command channel is closed.\n    #[cfg(feature = \"live\")]\n    pub fn reconnect_socket(&self, client_id: ClientId, endpoint: &str) -> anyhow::Result<()> {\n        let endpoint = socket_endpoint(endpoint)?;\n\n        if !self.is_properly_registered() {\n            anyhow::bail!(\n                \"Actor {} has not been registered with a Trader\",\n                self.actor_id\n            );\n        }\n\n        let sender = try_get_system_command_sender()\n            .ok_or_else(|| anyhow::anyhow!(\"Live runner system command channel is unavailable\"))?;\n        let trader_id = self\n            .trader_id\n            .ok_or_else(|| anyhow::anyhow!(\"Actor {} has no trader ID\", self.actor_id))?;\n        let command = ReconnectSocket::new(trader_id, client_id, endpoint, self.timestamp_ns());\n        sender\n            .send(SystemCommand::ReconnectSocket(command))\n            .map_err(|_| anyhow::anyhow!(\"Live runner system command channel is closed\"))?;\n        Ok(())\n    }\n\n    #[cfg(test)]\n    pub fn quote_handler_count(&self) -> usize {\n        self.quote_handlers.len()\n    }\n\n    #[cfg(test)]\n    pub fn trade_handler_count(&self) -> usize {\n        self.trade_handlers.len()","sourceCodeStart":5742,"sourceCodeEnd":5778,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/common/src/actor/data_actor.rs#L5742-L5778","documentation":"DataActor::reconnect_socket requires a live runner system command channel to forward a ReconnectSocket command to the trader. The actor tries `try_get_system_command_sender()`; when it returns None there is no registered system command sender, so the reconnect request cannot be delivered. This only works when the actor runs inside a live (or wired test) runner that has installed the system command channel.","triggerScenarios":"Calling DataActor's reconnect_socket (which builds a ReconnectSocket command for a client_id/endpoint) when no system command sender is registered via try_get_system_command_sender — e.g. the actor runs under a backtest or standalone context, or the live runner has not yet set up its system command channel.","commonSituations":"Running an actor that requests socket reconnection outside a LiveNodeInstance (backtest engine, isolated actor test); calling reconnect before the live runner finishes wiring its command channels; custom harnesses that register the actor with a Trader but never install the system command sender.","solutions":["Run the actor inside a live node (TradingNode/LiveRunner) so the system command channel is registered before the actor starts.","Ensure the actor is started only after the live runner has initialized its system command sender (check node startup ordering).","In tests or backtests, either install a mock system command sender or avoid calling reconnect_socket.","Guard calls: check that the actor is executing in a live context before requesting a socket reconnect."],"exampleFix":"// before\nactor.reconnect_socket(client_id, endpoint)?; // panics/errors in backtest\n\n// after\nif is_live_context() {\n    actor.reconnect_socket(client_id, endpoint)?;\n} else {\n    tracing::warn!(\"reconnect_socket requires a live runner; skipping\");\n}","handlingStrategy":"fallback","validationCode":"// Rust\nif try_get_system_command_sender().is_none() {\n    tracing::warn!(\"no system command channel; skipping socket reconnect\");\n    return Ok(());\n}","typeGuard":"fn has_system_command_channel() -> bool { try_get_system_command_sender().is_some() }","tryCatchPattern":"match actor.reconnect_socket(client_id, endpoint) {\n    Ok(()) => {},\n    Err(e) if e.to_string().contains(\"system command channel is unavailable\") => {\n        tracing::warn!(\"reconnect unavailable outside live runner: {e}\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Only request socket reconnections from actors running under a live node.","Add a startup assertion that the system command channel is present in live deployments.","In backtests/tests, stub the system command sender or skip reconnect logic."],"tags":["live-runner","actor","system-command-channel","socket-reconnect"],"backgroundTag":"resource-not-found","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}