nautechsystems/nautilus_trader · error
Blockchain execution client is not connected
Error message
Blockchain execution client is not connected
What it means
ensure_transaction_ready() is the pre-flight gate for submitting any transaction (wrap, approve, swap). It first requires the execution client to be connected to the chain via core.is_connected(); if not, it fails closed so no transaction is signed or submitted while the client is offline.
Source
Thrown at crates/adapters/blockchain/src/execution/client.rs:1522
match purpose {
TransactionPurpose::Wrap => {
verify_wrap_balance_increase(executor, &to, value, included).await
}
TransactionPurpose::Approve => {
let call = ERC20::approveCall::abi_decode(&input)
.with_context(|| "persisted approve calldata is invalid")?;
verify_approve_allowance(executor, &to, &call.spender, call.amount, included).await
}
TransactionPurpose::Swap => {
unreachable!("swap intents restore a swap plan")
}
}
}
fn ensure_transaction_ready(&self, purpose: TransactionPurpose) -> anyhow::Result<()> {
if !self.core.is_connected() {
anyhow::bail!("Blockchain execution client is not connected");
}
{
let slot = self.in_flight.lock();
if let Some(in_flight) = *slot {
return Err(in_flight_limit_error(&in_flight));
}
}
if !self.cache.has_database() {
anyhow::bail!(
"No durable store configured; refusing to submit a {} transaction",
purpose.as_str()
);
}
Ok(())
}
View on GitHub (pinned to 18893faf8b)
Solutions
- Await a successful connect() (and any required post-connect reconciliation) before calling wrap, approve, or submit_order.
- Check connection state (client.is_connected()) in your strategy loop and gate order submission on it.
- Verify the RPC endpoint/URL and network reachability, then reconnect; re-establish the WebSocket/HTTP provider if it dropped.
- Handle the not-connected error by pausing trading and retrying connect with backoff instead of resubmitting transactions.
Example fix
// before: submit immediately, fails if not yet connected
client.submit_order(order)?;
// after: gate on connection before trading
if !client.is_connected() {
client.connect().await.expect("execution client connect");
}
assert!(client.is_connected());
client.submit_order(order)?; Defensive patterns
Strategy: try-catch
Validate before calling
// Gate submission on connection state before calling wrap/approve/submit_order
if !client.is_connected() {
client.connect().await?; // or defer submission until connected
} Try / catch
match client.submit_order(order) {
Err(e) if e.to_string().contains("not connected") => {
log::warn!("execution client offline; pausing trading");
client.connect().await?; // reconnect with backoff, then resubmit
}
result => result?,
} Prevention
- Await connect() (and post-connect reconciliation) completion before enabling order submission.
- Subscribe to connection-state changes and pause trading on disconnect.
- Configure RPC reconnect/backoff and health checks so is_connected() recovers promptly.
- Use a connection watchdog that reconnects automatically during provider outages.
When it happens
Trigger: Calling wrap(), approve(), or prepare_swap() (e.g. via submit_order) before connect() succeeded, or after the connection dropped/was closed (RPC endpoint down, network interruption, client explicitly disconnected).
Common situations: Submitting an order at startup before the async connect completed; RPC provider outage or WebSocket disconnect mid-session; calling wrap/approve on a fresh client without connecting; a dropped network causing is_connected() to flip false while the strategy keeps trading.
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
- Active execution intent {intent_id} was not found
- Finalized block {} does not contain transaction {}
- Finalized execution transaction {tx_hash} no longer has a re
- Canonical head changed during signer-nonce replacement scan
- Finalized block {} changed from {} to {} before intent valid
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/c18d3d287dae695e.
Report an issue: GitHub.