nautechsystems/nautilus_trader · error · anyhow::Error
Latest block has no base fee
Error message
Latest block {} has no base fee What it means
The preflight fee derivation needs the latest block's base fee per gas to compute max_fee_per_gas. If the RPC returns a latest block without base_fee_per_gas (None), the code cannot derive EIP-1559 fees and raises. This typically means the chain or RPC endpoint does not support EIP-1559.
Solutions
- Point the RPC at an EIP-1559-compatible endpoint for the intended chain
- Verify the configured chain id matches a network that supports base fee (post-London)
- Use a different provider whose latest_block includes baseFeePerGas
Defensive patterns
Strategy: try-catch
Validate before calling
let block = rpc.latest_block().await?;
if block.base_fee_per_gas.is_none() {
return Err("chain does not support EIP-1559 base fee; check RPC/chain id".into());
} Try / catch
match client.preflight().await {
Err(e) if e.to_string().contains("has no base fee") => {
// switch to an EIP-1559-capable RPC or configure legacy gas
}
other => other?,
} Prevention
- Verify the target chain supports EIP-1559 before configuring the client
- Use reputable RPC providers that return baseFeePerGas
- Pin and verify chain id against a London+ hard-fork block
When it happens
Trigger: Calling preflight against a chain/RPC whose eth_getBlockByNumber response lacks baseFeePerGas (pre-London chains, some non-EVM-compatible RPCs, or mocked/proxy RPCs stripping the field).
Common situations: Pointing config at a legacy PoA/test network without EIP-1559; using a third-party RPC proxy that omits the field; wrong chain id selected.
Understand the failure class
Background: "invalid response format", "malformed payload", "missing data field": when an API returns 200 but the response shape is wrong — this error's family across 23 libraries.
Related errors
- Blockchain execution client is not connected
- Canonical head changed during signer-nonce replacement scan
- Canonical head is behind execution creation block
- eth_getCode returned no result
- eth_getStorageAt returned no result
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/2fae65c071de94c8.
Report an issue: GitHub.
Appendix: source
Thrown at crates/adapters/blockchain/src/execution/client.rs:641
}
tokens.push(TokenPreflightCheck {
address: token.address,
symbol: token.symbol.clone(),
has_deployed_code: !code.is_empty(),
wallet_balance,
router_allowances,
});
}
let native_balance_wei = self
.http_rpc_client
.get_balance_with_timeout(&self.wallet_address, None, Some(EXECUTION_RPC_TIMEOUT_SECS))
.await?;
let latest_block = self.http_rpc_client.latest_block().await?;
let base_fee_per_gas_wei = latest_block.base_fee_per_gas.ok_or_else(|| {
anyhow::anyhow!("Latest block {} has no base fee", latest_block.number)
})?;
let max_priority_fee_per_gas_wei = self.http_rpc_client.max_priority_fee_per_gas().await?;
let derived_max_fee_per_gas_wei = compute_max_fee(
base_fee_per_gas_wei,
max_priority_fee_per_gas_wei,
self.config.base_fee_buffer_bps,
)?;
Ok(BlockchainPreflightReport::new(
u64::from(self.chain.chain_id),
actual_chain_id,
pool_check,
routers,
tokens,
native_balance_wei,
base_fee_per_gas_wei,
max_priority_fee_per_gas_wei,
derived_max_fee_per_gas_wei,View on GitHub (pinned to 18893faf8b)