nautechsystems/nautilus_trader · error
Failed to start Tardis task generation: {e}
Error message
Failed to start Tardis task generation: {e} What it means
Raised in connect when tasks.start_generation() fails while preparing the Tardis client for a new connection. The task supervisor could not open a new task generation, so no WebSocket stream task can be registered.
Source
Thrown at crates/adapters/tardis/src/data.rs:521
}
async fn connect(&mut self) -> anyhow::Result<()> {
if self.is_connected() && self.tasks.is_open() {
return Ok(());
}
if self.config.options.is_empty() && self.config.stream_options.is_empty() {
anyhow::bail!("Either replay `options` or `stream_options` must be provided");
}
if !self.tasks.is_open() {
self.tasks
.finish_shutdown(Duration::from_secs(1), Duration::from_secs(2))
.await
.map_err(|e| anyhow::anyhow!("Failed to terminate Tardis tasks: {e}"))?;
self.tasks
.start_generation()
.map_err(|e| anyhow::anyhow!("Failed to start Tardis task generation: {e}"))?;
self.cancellation_token = self.tasks.cancellation_token();
}
let is_stream_mode = self.is_stream_mode();
let book_snapshot_output = self.config.book_snapshot_output.clone();
let extract_bbo_as_quotes = self.config.extract_bbo_as_quotes;
let http_client = TardisHttpClient::new(
self.config
.api_key
.as_ref()
.map(|value| value.expose_secret()),
None,
None,
self.config.normalize_symbols,
self.config
.proxy_url
.as_ref()View on GitHub (pinned to 18893faf8b)
Solutions
- Wait for the previous shutdown to fully complete before reconnecting.
- Verify finish_shutdown succeeded (error 3693 not raised) in the same connect path.
- Serialize connect/disconnect calls; do not overlap lifecycle transitions.
- Reconstruct the client if its task set is permanently closed.
Defensive patterns
Strategy: try-catch
Try / catch
if let Err(e) = client.connect().await {
if e.to_string().contains("Failed to start Tardis task generation") {
// supervisor is closed: recreate the client rather than retrying
client = TardisDataClient::new(config)?;
client.connect().await?;
} else { return Err(e); }
} Prevention
- Treat connect after a permanent stop as a bug; create a fresh client instead.
- Serialize lifecycle transitions; never overlap shutdown with connect.
- Check for earlier shutdown errors (3693) that leave the supervisor wedged.
When it happens
Trigger: Calling connect on a task set that is closed or still mid-shutdown, so start_generation is rejected.
Common situations: Rapid disconnect/reconnect cycling; a previously failed finish_shutdown leaving the supervisor in a bad state; calling connect after the client was stopped permanently.
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
- std::mem::take(&mut self.shutdown_errors).join("; ")
- Binance Spot public JSON stream pool is shutting down
- No active WebSocket client
- WebSocket output receiver not available
- {context}: {}
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/88010dff05141b42.
Report an issue: GitHub.