nautechsystems/nautilus_trader · error
std::mem::take(&mut self.shutdown_errors).join("; ")
Error message
std::mem::take(&mut self.shutdown_errors).join("; ") What it means
Identical pattern to the data client: AX execution client's `teardown_partial_connect` drains self.shutdown_errors and bails with them joined by ';'. It indicates the execution connect failed partway and cleanup steps (e.g. awaiting pending results) also reported errors.
Source
Thrown at crates/adapters/architect_ax/src/execution.rs:452
if let Err(e) = self.ws_orders.close().await {
self.shutdown_errors
.push(format!("AX orders WebSocket shutdown failed: {e}"));
}
let (session_result, pending_result) =
tokio::join!(self.await_session_tasks(), self.await_pending_tasks());
self.core.set_disconnected();
if let Err(e) = session_result {
self.shutdown_errors.push(e.to_string());
}
if let Err(e) = pending_result {
self.shutdown_errors.push(e.to_string());
}
if !self.shutdown_errors.is_empty() {
anyhow::bail!(std::mem::take(&mut self.shutdown_errors).join("; "));
}
Ok(())
}
/// Polls the cache until the account is registered or timeout is reached.
async fn await_account_registered(&self, timeout_secs: f64) -> anyhow::Result<()> {
let account_id = self.core.account_id;
if self.core.cache().account(&account_id).is_some() {
log::info!("Account {account_id} registered");
return Ok(());
}
let start = Instant::now();
let timeout = Duration::from_secs_f64(timeout_secs);
let interval = Duration::from_millis(10);
loop {View on GitHub (pinned to 18893faf8b)
Solutions
- Parse the joined messages to identify the root failure versus secondary teardown errors
- Fix the underlying connect problem (credentials, gateway URL, network) and reconnect
- Check whether the pending-result error indicates an unresponsive gateway needing a longer timeout
Defensive patterns
Strategy: retry
Validate before calling
// Validate credentials and gateway URL before constructing the execution client
if api_key.is_empty() || gateway_url.is_empty() { return Err("missing AX exec config"); } Try / catch
match exec_client.connect().await {
Ok(()) => {},
Err(e) => { log::error!("AX exec connect failed: {e}"); /* fix root cause, then reconnect */ }
} Prevention
- Pre-flight credential validation against the AX auth endpoint
- Give teardown generous timeouts so pending results can settle
- Alert on the first message in the joined error string, which usually names the primary failure
When it happens
Trigger: connect() on AXExecutionClient partially succeeds then fails (auth rejected, account lookup fails), and teardown tasks/pending results return errors.
Common situations: Invalid API credentials; AX execution gateway down; timeout races during client startup.
Understand the failure class
Background: ECONNREFUSED and "connection refused" / "could not connect to server" errors: what they mean and how to fix them — this error's family across 44 libraries.
Related errors
- std::mem::take(&mut self.shutdown_errors).join("; ")
- Timeout waiting for account {account_id} to be registered af
- WebSocket output receiver not available
- Failed to start Coinbase task generation: {e}
- Cannot send order event: sender not initialized
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/cc68efaa3e3271f4.
Report an issue: GitHub.